Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Storage Transfer Service può copiare file da un elenco di URL pubblici nel tuo
bucket Cloud Storage.
Quando crei un trasferimento, fornisci un link a un file con valori separati da tabulazioni (TSV) contenente gli URL e i dettagli degli oggetti da trasferire. Il file TSV può essere ospitato in qualsiasi posizione HTTP o HTTPS accessibile pubblicamente oppure può essere archiviato in un bucket Cloud Storage.
Questa pagina spiega come creare un elenco di URL e passarlo al comando di creazione del job.
Requisiti dei file di origine
Gli URL devono essere accessibili pubblicamente e utilizzare i protocolli HTTP o HTTPS.
Il server che ospita ogni oggetto:
Non deve negare l'accesso all'oggetto con un robots.txt.
Supporta le richieste Range.
Restituisce un'intestazione Content-Length in ogni risposta.
Formato elenco URL
Un elenco di URL deve rispettare i seguenti requisiti:
Il file deve essere formattato come valori separati da tabulazioni.
Gli URL devono essere in ordine alfabetico UTF-8.
La prima riga deve specificare TsvHttpData-1.0.
Dopo la prima riga, specifica un oggetto per riga.
Ogni riga deve contenere l'URL e può contenere anche le dimensioni del file e la somma di controllo MD5 codificata in base64 dell'oggetto.
Di seguito è riportato un file TSV di esempio che specifica due oggetti da trasferire. Tieni presente che su questa pagina le tabulazioni vengono visualizzate come spazi. Per il tuo file, assicurati di utilizzare le tabulazioni tra i campi.
Assicurati che le dimensioni specificate corrispondano alle dimensioni effettive dell'oggetto quando viene recuperato. Se le dimensioni dell'oggetto ricevuto da Cloud Storage non corrispondono a quelle specificate, il trasferimento dell'oggetto non andrà a buon fine.
(Facoltativo) Il checksum MD5 dell'oggetto con codifica base64.
Assicurati che il checksum MD5 specificato corrisponda al checksum MD5 calcolato
dai byte trasferiti. Se il checksum MD5 dell'oggetto ricevuto
da Cloud Storage non corrisponde al checksum MD5 specificato, il
trasferimento dell'oggetto non andrà a buon fine.
Sebbene le dimensioni dell'oggetto e i valori del checksum MD5 siano facoltativi, consigliamo vivamente di includerli per garantire l'integrità dei dati.
Hosting dell'elenco di URL
L'elenco di URL può essere ospitato in una delle due posizioni:
Un URL pubblicamente accessibile.
Un bucket Cloud Storage a cui è stato concesso l'accesso all'agente di servizio per Storage Transfer Service.
URL accessibili pubblicamente
Quando l'elenco di URL viene archiviato in un URL pubblicamente accessibile, si applicano i seguenti requisiti:
L'URL deve iniziare con http:// o https://.
Il server deve impostare un'intestazione Etag sicura nella risposta HTTP quando restituisce l'elenco di URL.
Per evitare di archiviare l'elenco in una posizione pubblica, puoi archiviarlo in un bucket Cloud Storage e concedere l'accesso all'agente di servizio per Storage Transfer Service.
All'agente di servizio devono essere concesse le seguenti autorizzazioni:
L'autorizzazione storage.object.get per l'oggetto. Questo può essere concesso concedendo il ruolo roles/storage.legacyObjectReader al bucket o con un ruolo personalizzato.
L'autorizzazione storage.buckets.get sul bucket. Questo può essere concesso concedendo il ruolo roles/storage.legacyBucketReader o un ruolo personalizzato.
Per concedere le autorizzazioni all'agente di servizio:
Viene visualizzato un riquadro interattivo denominato Prova questo metodo.
Nel riquadro, in Parametri di richiesta, inserisci il tuo ID progetto. Il progetto specificato qui deve essere quello che utilizzi per gestire Storage Transfer Service, che potrebbe essere diverso dal progetto del bucket dell'elenco di URL.
Fai clic su Execute (Esegui).
L'email dell'agente di servizio viene restituita come valore di accountEmail e utilizza il formato project-PROJECT_NUMBER@storage-transfer-service.iam.gserviceaccount.com.
Copia questo valore.
Concedere i ruoli richiesti
Per concedere il ruolo roles/storage.objectViewer e il ruolo
roles/storage.bucketViewer all'agente di servizio nel bucket contenente
l'elenco di URL, segui le istruzioni riportate in
Impostare e gestire le policy IAM nei bucket.
L'entità che stai aggiungendo è l'indirizzo email dell'agente di servizio. Se necessario,
l'identificatore principale è serviceAccount. Ad esempio,
serviceAccount:project-PROJECT_NUMBER@storage-transfer-service.iam.gserviceaccount.com.
Creare un job di trasferimento di un elenco di URL
Per specificare un elenco di URL durante la creazione di un job di trasferimento:
In Tipo di origine, seleziona Elenco di URL e fai clic su Passaggio successivo.
In URL del file TSV, fornisci l'URL del file con valori separati da tabulazioni (TSV). L'URL è un indirizzo HTTP/HTTPS (ad es.
https://example.com/urllist.tsv) o un percorso Cloud Storage
(ad es. gs://my-bucket/urllist.tsv).
Interfaccia a riga di comando gcloud
Per creare un nuovo job di trasferimento, utilizza il comando gcloud transfer jobs create.
gcloudtransferjobscreate\SOURCEDESTINATION
Per i trasferimenti di elenchi di URL, il valore di SOURCE è l'URL del
file TSV. L'URL è un indirizzo HTTP/HTTPS (ad es.
https://example.com/urllist.tsv) o un percorso Cloud Storage
(ad es. gs://my-bucket/urllist.tsv).
Per ulteriori informazioni sulla creazione di trasferimenti utilizzando gcloud CLI, consulta Creare job di trasferimento.
REST
Per creare un job di trasferimento di elenchi di URL utilizzando l'API REST, specifica l'URL del
file TSV nel campo listUrl:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-03 UTC."],[],[],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)."]]