[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[],[],null,["# Transfer from public URLs to Cloud Storage\n\nStorage Transfer Service can copy files from a list of public URLs to your\nCloud Storage bucket.\n\nWhen creating a transfer, you provide a link to a tab-separated values (TSV)\nfile containing the URLs and details of the objects to transfer. The TSV file\ncan be hosted in any publicly-accessible HTTP or HTTPS location; or can be\nstored in a Cloud Storage bucket.\n\nThis page explains how to create a URL list and pass it to the job creation\ncommand.\n\nSource file requirements\n------------------------\n\n- URLs must be publicly-accessible and use HTTP or HTTPS protocols.\n- The server hosting each object:\n - Must not deny access to the object with a `robots.txt`.\n - Supports `Range` requests.\n - Returns a `Content-Length` header in each response.\n\nURL list format\n---------------\n\nA URL list must adhere to the following requirements:\n\n- The file must be formatted as tab-separated values.\n- URLs must be in UTF-8 lexicographical order.\n- The first line must specify `TsvHttpData-1.0`.\n- After the first line, specify one object per row.\n- Each row must contain the URL, and may also contain the file size and the base64-encoded MD5 checksum of the object.\n\nThe following is a sample TSV file that specifies two objects to transfer. Note\nthat on this page the tabs are rendered as spaces; for your own file, make sure\nto use tabs between fields. \n\n TsvHttpData-1.0\n https://example.com/myfile.pdf 1357 wHENa08V36iPYAsOa2JAdw==\n https://example2.com/images/dataset1/flower.png 2468 R9acAaveoPd2y8nniLUYbw==\n\nEach line contains:\n\n- The HTTP or HTTPS URL of a source object.\n- (Optional) The size of the object in bytes.\n\n Ensure that the specified size matches the actual size of the object\n when it is fetched. If the size of the object received by\n Cloud Storage does not match the size specified, the object\n transfer will fail.\n- (Optional) The base64-encoded MD5 checksum of the object.\n\n Ensure that the specified MD5 checksum matches the MD5 checksum computed\n from the transferred bytes. If the MD5 checksum of the object received\n by Cloud Storage does not match the MD5 checksum specified, the\n object transfer will fail.\n | **Note:** Many checksumming tools output an object's MD5 checksum in base16-encoded format. Ensure the values provided are in base64-encoded format.\n\nWhile the object size and MD5 checksum values are optional, we strongly\nrecommend including them to help ensure data integrity.\n\nHosting the URL list\n--------------------\n\nThe URL list can be hosted in one of two locations:\n\n- A publicly-accessible URL.\n- A Cloud Storage bucket, to which the service agent for Storage Transfer Service\n has been granted access.\n\n### Publicly-accessible URLs\n\nWhen storing the URL list at a publicly-accessible URL, the following\nrequirements apply:\n\n- The URL must begin with `http://` or `https://`.\n- The server must set a strong `Etag` header in the HTTP response when it returns the URL list.\n\nFor example, you can store the list in a Cloud Storage bucket and\n[share the object publicly](/storage/docs/cloud-console#_sharingdata) to\nget a link to it.\n\n### Cloud Storage buckets\n\nTo avoid storing your list in a public location, you can store it in a\nCloud Storage bucket, and grant access to the service agent\nfor Storage Transfer Service.\n\nThe service agent must be granted the following permissions:\n\n- The `storage.object.get` permission on the object. This can be granted by granting the `roles/storage.legacyObjectReader` role on the bucket, or with a custom role.\n- The `storage.buckets.get` permission on the bucket. This can be granted by granting the `roles/storage.legacyBucketReader` role, or with a custom role.\n\nTo grant permissions to the service agent:\n\n#### Find the service agent's email\n\n1. Go to the\n [`googleServiceAccounts.get` reference\n page](/storage-transfer/docs/reference/rest/v1/googleServiceAccounts/get).\n\n An interactive panel opens, titled **Try this method**.\n2. In the panel, under **Request parameters**, enter your\n project ID. The project you specify here must be the project you're\n using to manage Storage Transfer Service, which might be different from the URL\n list bucket's project.\n\n3. Click **Execute**.\n\nYour service agent's email is returned as the value of `accountEmail` and\nuses the format\n`project-`\u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e`@storage-transfer-service.iam.gserviceaccount.com`.\n\nCopy this value.\n\n#### Grant the required roles\n\nTo grant the `roles/storage.objectViewer` role and the\n`roles/storage.bucketViewer` role to the service agent on the bucket containing\nthe URL list, follow the instructions in\n[Set and manage IAM policies on buckets](/storage/docs/access-control/using-iam-permissions).\n\nThe principal you are adding is the service agent's email address. If required,\nthe principal identifier is `serviceAccount`. For example,\n`serviceAccount:project-`\u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e`@storage-transfer-service.iam.gserviceaccount.com`.\n\nCreate a URL list transfer job\n------------------------------\n\nTo specify a URL list when creating a transfer job, follow these instructions: \n\n### Google Cloud console\n\nFollow the instructions in\n[Create a transfer job](/storage-transfer/docs/create-transfers#google-cloud-console).\n\nWhen choosing a source:\n\n1. Under **Source type** , select **URL list** and click **Next step**.\n\n2. Under **URL of TSV file** , provide the URL to your tab-separated values\n (TSV) file. The URL is either an HTTP/HTTPS address (e.g.\n `https://example.com/urllist.tsv`) or a Cloud Storage path\n (e.g. `gs://my-bucket/urllist.tsv`).\n\n### gcloud CLI\n\nTo create a new transfer job, use the `gcloud transfer jobs create`\ncommand. \n\n gcloud transfer jobs create \\\n \u003cvar translate=\"no\"\u003eSOURCE\u003c/var\u003e \u003cvar translate=\"no\"\u003eDESTINATION\u003c/var\u003e\n\nFor URL list transfers, the value of \u003cvar translate=\"no\"\u003eSOURCE\u003c/var\u003e is the URL of the\nTSV file. The URL is either an HTTP/HTTPS address (e.g.\n`https://example.com/urllist.tsv`) or a Cloud Storage path\n(e.g. `gs://my-bucket/urllist.tsv`).\n\nFor more information on creating transfers using gcloud CLI, see\n[Create transfer jobs](/storage-transfer/docs/create-transfers#gcloud-cli).\n\n### REST\n\nTo create a URL list transfer job using the REST API, specify the URL of the\nTSV file in the `listUrl` field: \n\n {\n \"projectId\": \"\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\",\n \"transferSpec\": {\n \"httpDataSource\": {\n \"listUrl\": \"\u003cvar translate=\"no\"\u003eURL\u003c/var\u003e\"\n },\n \"gcsDataSink\": {\n \"bucketName\": \"DESTINATION_BUCKET\"\n }\n },\n \"status\": \"ENABLED\"\n }\n\nThe value of \u003cvar translate=\"no\"\u003eURL\u003c/var\u003e is either an HTTP/HTTPS address (e.g.\n`https://example.com/urllist.tsv`) or a Cloud Storage path\n(e.g. `gs://my-bucket/urllist.tsv`).\n\nFor more details on creating transfers using the REST API, see the\n[REST API reference](/storage-transfer/docs/reference/rest/v1/transferJobs/create)."]]