El 15 de septiembre del 2026, todos los entornos de Cloud Composer 1 y Cloud Composer 2 versión 2.0.x alcanzarán el final de su ciclo de vida previsto y no podrás usarlos. Te recomendamos que planifiques la migración a Cloud Composer 3.
Puedes especificar un segmento de Cloud Storage personalizado como segmento de un entorno al crear un entorno. Tu entorno usa este segmento de la misma forma que el segmento del entorno predeterminado, y el segmento del entorno predeterminado no se crea.
Con un contenedor personalizado, puedes hacer lo siguiente:
Usa una configuración de contenedor que cumpla tus requisitos.
Usa un segmento que exista continuamente para realizar pruebas o desarrollos periódicos.
Reutiliza un bucket de un entorno anterior y conserva las integraciones de CI/CD y de datos.
Eliminar y volver a crear un entorno sin necesidad de transferir datos entre
contenedores.
Rellena el segmento personalizado con los datos necesarios, como los archivos DAG, y crea un entorno.
Antes de empezar
Esta función está disponible a partir de la versión 2.5.0 de Cloud Composer. Las versiones anteriores de Cloud Composer 2 no admiten esta función.
El segmento personalizado debe estar ubicado en la misma región que el entorno.
No se admiten los contenedores multirregionales ni birregionales.
El segmento personalizado y el entorno deben estar en el mismo proyecto.
No se puede usar el mismo segmento personalizado con varios entornos al mismo tiempo. Cloud Composer genera un error si otro entorno ya utiliza el bucket especificado. Puedes eliminar un entorno y, después, usar el mismo segmento para otro entorno.
Si has habilitado la opción de guardar los registros en el bucket del entorno, cuando elimines un entorno y utilices el mismo bucket para otro entorno, este último no mostrará los registros de tareas de Airflow del entorno anterior en la interfaz de usuario de Airflow. Los registros permanecen en el bucket, pero el nuevo entorno no los asocia a ninguna ejecución de DAG.
Cloud Composer no añade ningún permiso de IAM que falte al segmento de Cloud Storage cuando se usa para crear un entorno. Asegúrate de que la cuenta de servicio del entorno tenga permisos del rol de trabajador de Composer en el segmento.
Crear un entorno con un segmento personalizado
Consola
Para especificar un segmento de Cloud Storage personalizado al crear un entorno, sigue estos pasos:
En la página Crear entorno, en la sección Configuración avanzada, haz clic en Mostrar configuración avanzada.
Selecciona Segmento personalizado.
En el campo Nombre del contenedor, especifica o selecciona un contenedor.
gcloud
Cuando creas un entorno, el argumento --storage-bucket especifica el
cubo personalizado del entorno.
LOCATION: la región en la que se encuentra el entorno.
ENVIRONMENT_NAME: el nombre de tu entorno.
CUSTOM_STORAGE_BUCKET: el nombre de un segmento de Cloud Storage (sin el prefijo gs://).
Ejemplo:
// POST https://composer.googleapis.com/v1/{parent=projects/*/locations/*}/environments{"name":"projects/example-project/locations/us-central1/environments/example-environment","storageConfig":{"bucket":"us-central1-example-bucket"}}
Terraform
Cuando creas un entorno, el campo bucket del bloque storage_config especifica el segmento personalizado del entorno.
[[["Es fácil de entender","easyToUnderstand","thumb-up"],["Me ofreció una solución al problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Es difícil de entender","hardToUnderstand","thumb-down"],["La información o el código de muestra no son correctos","incorrectInformationOrSampleCode","thumb-down"],["Me faltan las muestras o la información que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-29 (UTC)."],[[["\u003cp\u003eCloud Composer 2 allows specifying a custom Cloud Storage bucket for an environment, which is used in place of the default environment's bucket, eliminating the creation of the default.\u003c/p\u003e\n"],["\u003cp\u003eUsing a custom bucket provides advantages such as compliance with specific bucket configurations, reusing existing buckets, and avoiding data transfer when deleting and recreating environments.\u003c/p\u003e\n"],["\u003cp\u003eThe custom bucket must meet specific requirements including being in the same region and project as the environment, using Standard storage class, and having no retention policies or locks.\u003c/p\u003e\n"],["\u003cp\u003eCreating an environment with a custom bucket can be done through the console, \u003ccode\u003egcloud\u003c/code\u003e command-line tool, API, or Terraform, each requiring the bucket name to be specified during environment creation.\u003c/p\u003e\n"],["\u003cp\u003eIt's important to know that Cloud Composer will not alter the encryption settings for a custom bucket, so it must be manually encrypted if needed, and that you must add the Composer worker role permissions to the bucket for the service account.\u003c/p\u003e\n"]]],[],null,["\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\n[Cloud Composer 3](/composer/docs/composer-3/custom-bucket \"View this page for Cloud Composer 3\") \\| **Cloud Composer 2** \\| Cloud Composer 1\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nYou can specify a custom Cloud Storage bucket as an environment's bucket\nwhen you create an environment. Your environment uses this\nbucket in the same way as the [default environment's bucket](/composer/docs/composer-2/cloud-storage),\nand the default environment's bucket is not created.\n\nWith a custom bucket, you can:\n\n- Use a bucket configuration that is compliant with your requirements.\n- Use a continuously existing bucket for periodic development or testing purposes.\n- Reuse an existing bucket from a previous environment and keep CI/CD and data integrations.\n- Delete and re-create an environment without the need to transfer data between buckets.\n- Pre-populate the custom bucket with required data, such as your DAG files, and then create an environment.\n\nBefore you begin\n\n- This feature is supported starting from Cloud Composer version 2.5.0. Earlier versions of Cloud Composer 2 do not support this feature.\n\n\u003c!-- --\u003e\n\n- The custom bucket must be located in the same region as the environment. Multi-region and dual-region buckets are not supported.\n- The custom bucket and the environment must be in the same project.\n- The custom bucket must have the [Standard storage class](/storage/docs/storage-classes).\n- The custom bucket must have no [retention policies or retention policy locks](/storage/docs/bucket-lock) applied to it.\n- It is not possible to use the same custom bucket with several environments at\n the same time. Cloud Composer generates an error if the\n specified bucket is already used by another environment. It is possible to\n delete an environment and then use the same bucket for another environment.\n\n- If you enabled\n [saving logs to the environment's bucket](/composer/docs/composer-2/enable-saving-logs-to-environment-bucket), then if\n you delete an environment and then use the same bucket for another\n environment, the new environment does not display Airflow task logs from\n the previous environment in Airflow UI. The logs remain in the bucket, but\n the new environment does not associate them with any DAG runs.\n\n- Cloud Composer doesn't add any missing IAM\n permissions to the Cloud Storage bucket when it is used to create an\n environment. Make sure that the environment's service account has\n [permissions from the Composer Worker role](/composer/docs/composer-2/access-control) on the bucket.\n\n| **Warning:** Cloud Composer does not alter the encryption settings of a custom bucket and thus does not [encrypt it with a CMEK key](/composer/docs/composer-2/configure-cmek-encryption) (even if the project's policies require encryption). Specifically, the custom bucket's encryption is not changed if your environment uses CMEK encryption. Your custom bucket follows policies of the project that it belongs to. You can [manually encrypt](/storage/docs/encryption/using-customer-managed-keys) the environment's bucket with CMEK keys before you create an environment.\n\nCreate an environment with a custom bucket \n\nConsole\n\nTo specify a custom Cloud Storage bucket when you create an\nenvironment:\n\n1. On the **Create environment** page, in the **Advanced configuration** section, click **Show advanced configuration**.\n2. Select **Custom bucket**.\n3. In the **Bucket name** field, specify or select a bucket.\n\ngcloud\n\nWhen you create an environment, the `--storage-bucket` argument specifies the\nenvironment's custom bucket. \n\n gcloud composer environments create \u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e \\\n --location \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --storage-bucket \u003cvar translate=\"no\"\u003eCUSTOM_STORAGE_BUCKET\u003c/var\u003e\n\nReplace the following:\n\n- `ENVIRONMENT_NAME`: the name of your environment.\n- `LOCATION`: the region where the environment is located.\n- `CUSTOM_STORAGE_BUCKET`: the name of a Cloud Storage bucket. You can also specify the bucket URI (with the `gs://` prefix).\n\nExample: \n\n gcloud composer environments create example-environment \\\n --location us-cental1 \\\n --storage-bucket us-central1-example-bucket\n\nAPI\n\nWhen you create an environment, in the [Environment](/composer/docs/reference/rest/v1/projects.locations.environments#Environment)\n\\\u003e [StorageConfig](/composer/docs/reference/rest/v1/projects.locations.environments#StorageConfig) resource, specify\na custom bucket for your environment. \n\n {\n \"name\": \"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e/environments/\u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e\",\n \"storageConfig\": {\n \"bucket\": \"\u003cvar translate=\"no\"\u003eCUSTOM_STORAGE_BUCKET\u003c/var\u003e\"\n }\n }\n\nReplace the following:\n\n- `PROJECT_ID`: the [Project ID](/resource-manager/docs/creating-managing-projects).\n- `LOCATION`: the region where the environment is located.\n- `ENVIRONMENT_NAME`: the name of your environment.\n- `CUSTOM_STORAGE_BUCKET`: the name of a Cloud Storage bucket (without the `gs://` prefix).\n\nExample: \n\n // POST https://composer.googleapis.com/v1/{parent=projects/*/locations/*}/environments\n\n {\n \"name\": \"projects/example-project/locations/us-central1/environments/example-environment\",\n \"storageConfig\": {\n \"bucket\": \"us-central1-example-bucket\"\n }\n }\n\nTerraform\n\nWhen you create an environment, the `bucket` field in the\n`storage_config` block specifies the environment's custom bucket.\n**Caution:** If you change the value of this field for an existing environment, Terraform deletes the existing environment and creates it again. \n\n resource \"google_composer_environment\" \"example\" {\n provider = google-beta\n name = \"\u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e\"\n region = \"\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e\"\n\n storage_config {\n\n bucket = \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-err\"\u003eCUSTOM_STORAGE_BUCKET\u003c/span\u003e\u003c/var\u003e\n\n }\n }\n\nReplace the following:\n\n- `ENVIRONMENT_NAME`: the name of your environment.\n- `LOCATION`: the region where the environment is located.\n- `CUSTOM_STORAGE_BUCKET`: the name of a Cloud Storage bucket. You can also specify the bucket URI (with the `gs://` prefix).\n\nExample: \n\n resource \"google_composer_environment\" \"example\" {\n provider = google-beta\n name = \"example-environment\"\n region = \"us-central1\"\n\n storage_config {\n\n bucket = \"gs://us-central1-example-bucket\"\n\n }\n }\n\nWhat's next\n\n- [About the environment's bucket](/composer/docs/composer-2/cloud-storage)\n- [CMEK in Cloud Composer](/composer/docs/composer-2/configure-cmek-encryption)\n- [Create environments](/composer/docs/composer-2/create-environments)"]]