Cómo transferir desde URLs públicas a Cloud Storage
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
El Servicio de transferencia de almacenamiento puede copiar archivos de una lista de URLs públicas a tu
bucket de Cloud Storage.
Cuando creas una transferencia, proporcionas un vínculo a un archivo de valores separados por tabulaciones (TSV)
que contiene las URLs y los detalles de los objetos que se transferirán. El archivo TSV se puede alojar en cualquier ubicación HTTP o HTTPS de acceso público, o bien se puede almacenar en un bucket de Cloud Storage.
En esta página, se explica cómo crear una lista de URLs y pasarla al comando de creación de trabajos.
Requisitos de los archivos de origen
Las URLs deben ser de acceso público y usar los protocolos HTTP o HTTPS.
El servidor que aloja cada objeto:
No debe denegar el acceso al objeto con un robots.txt.
Admite solicitudes Range
Devuelve un encabezado Content-Length en cada respuesta.
Formato de listas de URL
Una lista de URLs debe cumplir con los siguientes requisitos:
El archivo debe tener el formato de valores separados por tabulaciones.
Las URLs deben estar en orden lexicográfico UTF-8.
La primera línea debe especificar TsvHttpData-1.0.
Después de la primera línea, especifica un objeto por fila.
Cada fila debe contener la URL y también puede contener el tamaño del archivo y la suma de comprobación MD5 codificada en base64 del objeto.
El siguiente es un archivo TSV de muestra que especifica dos objetos para transferir. Ten en cuenta que, en esta página, las tabulaciones se renderizan como espacios. En tu propio archivo, asegúrate de usar tabulaciones entre campos.
Asegúrese de que el tamaño especificado coincida con el tamaño real del objeto cuando se recupera. Si el tamaño del objeto recibido por Cloud Storage no coincide con el tamaño especificado, la transferencia del objeto fallará.
La suma de comprobación MD5 codificada en base64 del objeto (opcional).
Asegúrese de que la suma de verificación MD5 especificada coincida con la suma de verificación MD5 calculada a partir de los bytes transferidos. Si la suma de verificación MD5 del objeto recibido por Cloud Storage no coincide con la suma de verificación MD5 especificada, la transferencia del objeto fallará.
Si bien el tamaño del objeto y los valores de la suma de comprobación MD5 son opcionales, te recomendamos que los incluyas para garantizar la integridad de los datos.
Cómo alojar la lista de URLs
La lista de URLs se puede alojar en una de las siguientes ubicaciones:
Una URL de acceso público
Un bucket de Cloud Storage al que se le otorgó acceso al agente de servicio del Servicio de transferencia de almacenamiento
URLs de acceso público
Cuando almacenas la lista de URLs en una URL de acceso público, se aplican los siguientes requisitos:
La URL debe comenzar con http:// o https://.
El servidor debe establecer un encabezado Etag sólido en la respuesta HTTP cuando muestra la lista de URL.
Para evitar almacenar tu lista en una ubicación pública, puedes almacenarla en un
bucket de Cloud Storage y otorgar acceso al agente de servicio
del Servicio de transferencia de almacenamiento.
Se deben otorgar los siguientes permisos al agente de servicio:
El permiso storage.object.get en el objeto. Para ello, otorga el rol roles/storage.legacyObjectReader en el bucket o con un rol personalizado.
El permiso storage.buckets.get en el bucket. Para otorgar este permiso, se puede otorgar el rol roles/storage.legacyBucketReader o un rol personalizado.
Para otorgar permisos al agente de servicio, haz lo siguiente:
Busca el correo electrónico del agente de servicio
Se abrirá un panel interactivo con el título Prueba este método.
En el panel, en Parámetros de solicitud, ingresa el ID de tu proyecto. El proyecto que especifiques aquí debe ser el proyecto que usas para administrar el Servicio de transferencia de almacenamiento, que puede ser diferente del proyecto del bucket de la lista de URLs.
Haz clic en Ejecutar.
El correo electrónico del agente de servicio se muestra como el valor de accountEmail y usa el formato project-PROJECT_NUMBER@storage-transfer-service.iam.gserviceaccount.com.
Copia este valor.
Otorga los roles necesarios
Para otorgar el rol roles/storage.objectViewer y el rol roles/storage.bucketViewer al agente de servicio en el bucket que contiene la lista de URLs, sigue las instrucciones que se indican en Configura y administra políticas de IAM en buckets.
El principal que agregas es la dirección de correo electrónico del agente de servicio. Si es necesario, el identificador principal es serviceAccount. Por ejemplo, serviceAccount:project-PROJECT_NUMBER@storage-transfer-service.iam.gserviceaccount.com
Crea un trabajo de transferencia de lista de URLs
Para especificar una lista de URLs cuando creas un trabajo de transferencia, sigue estas instrucciones:
Cuando elijas una fuente, ten en cuenta lo siguiente:
En Tipo de fuente, selecciona Lista de URL y haz clic en Siguiente paso.
En la URL de archivo TSV, proporciona la URL a tu archivo de valores separados por tabulaciones (TSV). La URL es una dirección HTTP/HTTPS (p.ej., https://example.com/urllist.tsv) o una ruta de acceso de Cloud Storage (p.ej., gs://my-bucket/urllist.tsv).
gcloud CLI
Para crear un nuevo trabajo de transferencia, usa el comando gcloud transfer jobs create.
gcloudtransferjobscreate\SOURCEDESTINATION
En el caso de las transferencias de listas de URLs, el valor de SOURCE es la URL del archivo TSV. La URL es una dirección HTTP/HTTPS (p.ej., https://example.com/urllist.tsv) o una ruta de acceso de Cloud Storage (p.ej., gs://my-bucket/urllist.tsv).
El valor de URL es una dirección HTTP/HTTPS (p.ej., https://example.com/urllist.tsv) o una ruta de acceso de Cloud Storage (p.ej., gs://my-bucket/urllist.tsv).
Para obtener más detalles sobre cómo crear transferencias con la API de REST, consulta la referencia de la API de REST.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-18 (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)."]]