Le 15 septembre 2026, tous les environnements Cloud Composer 1 et Cloud Composer 2 version 2.0.x atteindront leur fin de vie prévue et vous ne pourrez plus les utiliser. Nous vous recommandons de planifier la migration vers Cloud Composer 3.
Cette page explique comment attribuer des libellés à vos environnements Cloud Composer pour ensuite ventiler les coûts de facturation en fonction de ces libellés.
À propos des libellés d'environnement
Les libellés d'environnement sont des paires clé/valeur que vous pouvez attribuer à vos environnements. Par exemple, si owner:engineering-team est un libellé personnalisé, owner est la clé et engineering-team est la valeur.
Chaque environnement peut avoir plusieurs libellés, mais les clés de libellé d'un même environnement doivent être uniques. Vous pouvez attribuer la même clé et la même valeur à plusieurs environnements.
Libellés d'environnement dans les rapports de facturation
Les libellés d'environnement que vous attribuez à vos environnements sont visibles dans les rapports de facturation. Vous pouvez donc ventiler les coûts en fonction des clés et des valeurs des libellés.
Les libellés ne s'appliquent pas rétroactivement. Par exemple, si vous attribuez un libellé le 15 mai, les coûts de facturation du 14 mai ne seront pas associés au libellé attribué.
Attribuer des libellés à de nouveaux environnements
Vous pouvez attribuer des libellés lors de la création d'un environnement. Pour en savoir plus, consultez la page Créer des environnements.
Attribuer des libellés à des environnements existants
Console
Accédez à la page Environnements dans la console Google Cloud :
Cliquez sur Modifier, puis sur Ajouter un libellé.
Ajoutez une paire clé-valeur pour le libellé, puis cliquez sur Enregistrer.
Attendez que l'environnement soit mis à jour.
gcloud
Lorsque vous mettez à jour un environnement à l'aide de la commande gcloud composer, les arguments suivants spécifient des libellés pour l'environnement :
--clear-labels supprime tous les libellés.
--update-labels met à jour les libellés spécifiés ou les crée s'ils n'existent pas déjà.
--remove-labels supprime les libellés spécifiés. Les libellés spécifiés qui n'existent pas sont ignorés.
Si vous utilisez plusieurs de ces arguments, ils sont appliqués dans l'ordre suivant : --clear-labels, --update-labels, --remove-labels.
Lorsque vous mettez à jour un environnement, spécifiez de nouveaux libellés pour votre environnement dans la ressource Environnement.
Remplacer tous les libellés
Pour remplacer tous les libellés, incluez labels dans le paramètre de requête updateMask et fournissez une valeur de remplacement dans le corps de la requête.
Pour supprimer tous les libellés, incluez labels dans le paramètre de requête updateMask et ne fournissez pas de valeur de remplacement.
Mettre à jour des libellés individuels
Pour mettre à jour un libellé ou en ajouter un, incluez labels.LABEL_KEY dans le paramètre de requête updateMask et fournissez une valeur de remplacement dans le corps de la requête.
Pour supprimer des libellés, incluez labels.LABEL_KEY dans le paramètre de requête updateMask et ne fournissez pas de valeur de remplacement.
Terraform
Pour créer un environnement avec des paramètres par défaut à un emplacement spécifié, modifiez le bloc labels dans votre configuration Terraform, puis exécutez terraform apply.
resource "google_composer_environment" "example" {
name = "example-environment"
region = "us-central1"
labels = {
LABEL_KEY = "LABEL_VALUE"
}
}
Remplacez :
LABEL_KEY par la clé de libellé d'environnement que vous souhaitez créer ou mettre à jour. Pour supprimer des libellés, supprimez leurs champs.
LABEL_VALUE par la valeur du libellé d'environnement.
Une fois que les libellés de votre environnement se sont propagés aux rapports de facturation, vous pouvez ventiler les coûts de facturation en fonction des libellés :
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/03 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/03 (UTC)."],[[["\u003cp\u003eEnvironment labels are key-value pairs you can assign to Cloud Composer environments to organize and track resources, such as \u003ccode\u003eowner:engineering-team\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThese labels can be used in billing reports to break down costs based on the assigned label keys and values, allowing for detailed cost analysis.\u003c/p\u003e\n"],["\u003cp\u003eLabels can be assigned to both new and existing environments through the Google Cloud console, \u003ccode\u003egcloud\u003c/code\u003e command-line tool, API, and Terraform.\u003c/p\u003e\n"],["\u003cp\u003eWhen using \u003ccode\u003egcloud\u003c/code\u003e, labels can be cleared, updated, or removed by using the arguments \u003ccode\u003e--clear-labels\u003c/code\u003e, \u003ccode\u003e--update-labels\u003c/code\u003e, and \u003ccode\u003e--remove-labels\u003c/code\u003e, respectively, which are applied in that order if used together.\u003c/p\u003e\n"],["\u003cp\u003eChanges to labels are not retroactive in billing reports, and it may take up to one day for label assignments to be reflected in these reports.\u003c/p\u003e\n"]]],[],null,["\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\n[Cloud Composer 3](/composer/docs/composer-3/manage-environment-labels \"View this page for Cloud Composer 3\") \\| [Cloud Composer 2](/composer/docs/composer-2/manage-environment-labels \"View this page for 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\nThis page explains how to assign labels to your Cloud Composer environments and then break down billing costs based on these labels.\n\nAbout environment labels\n\nEnvironment labels are key-value pairs that you can assign to your\nenvironments. For example, if `owner:engineering-team` is a custom label, then\n`owner` is the key, and `engineering-team` is the value.\n\nEach environment can have multiple labels, but the label keys for a single\nenvironment must be unique. You can assign a same key and value to several\nenvironments.\n\nEnvironment labels in billing reports\n\nEnvironment labels that you assign to your environments are visible in billing\nreports, so you can break down costs based on both keys and values from the\nlabels.\n| **Important:** It might take **up to 1 day** for environment labels to propagate to billing reports. However, the billing costs are labeled starting from the moment when you assigned the label to your environment.\n\nLabels don't apply retroactively. For example, if you assign a label on\nMay 15, billing costs for May 14 do not contain the assigned label.\n\nAssign labels to new environments\n\nYou can assign labels when you create an environment. For more information,\nsee [Creating environments](/composer/docs/composer-1/create-environments#labels).\n\nAssign labels to existing environments \n\nConsole\n\n1. Go to the **Environments** page in the Google Cloud console:\n\n [Go to Environments](https://console.cloud.google.com/composer/environments)\n2. Select your environment.\n\n3. Go to the **Labels** tab.\n\n4. Click **Edit** , then click **Add label**.\n\n5. Add a key-value pair for the label, then click **Save**.\n\n6. Wait until the environment updates.\n\ngcloud\n\nWhen you update an environment using\nthe [`gcloud composer`](/sdk/gcloud/reference/composer/environments/update) command, the following arguments\nspecify labels for the environment:\n\n- `--clear-labels` removes all labels.\n\n- `--update-labels` updates specified labels; creates new labels if they\n don't already exist.\n\n- `--remove-labels` removes specified labels; specified label that do not\n exist are ignored.\n\nIf you use several of these arguments, they are applied in the following\norder: `--clear-labels`, `--update-labels`, `--remove-labels`.\n\n**Update or create labels** \n\n gcloud composer environments update \u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e \\\n --location \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --update-labels \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nv\"\u003eLABEL_KEY\u003c/span\u003e\u003c/var\u003e=\u003cvar translate=\"no\"\u003eLABEL_VALUE\u003c/var\u003e\n\n**Remove specified labels** \n\n gcloud composer environments update \u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e \\\n --location \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --remove-labels \u003cvar translate=\"no\"\u003eLABEL_KEY\u003c/var\u003e\n\n**Remove all labels** \n\n gcloud composer environments update \u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e \\\n --location \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --clear-labels\n\nReplace:\n\n- `ENVIRONMENT_NAME` with the name of the environment.\n- `LOCATION` with the region where the environment is located.\n- `LABEL_KEY` with the environment label key that you want to create, update, or remove.\n- `LABEL_VALUE` with the environment label value.\n\n**Example**\n\nThe following example updates the `owner` label, creates the new `env`\nlabel, and removes the `misc` label: \n\n gcloud composer environments update example-environment \\\n --location us-central1 \\\n --update-labels owner=engineering-team,env=production \\\n --remove-labels misc\n\nAPI\n\nWhen you update an environment, in the [Environment](/composer/docs/reference/rest/v1/projects.locations.environments#Environment)\nresource, specify new labels of your environment.\n\n**Replace all labels**\n\nTo replace all labels, include `labels` in the `updateMask` query parameter\nand provide a replacement in the request body. \n\n // PATCH https://composer.googleapis.com/v1/\n // ?{name=projects/*/locations/*/environments/*}\n // &updateMask.fieldPaths=labels\n\n {\n \"labels\":{\n \"\u003cvar translate=\"no\"\u003eLABEL_KEY\u003c/var\u003e\": \"\u003cvar translate=\"no\"\u003eLABEL_VALUE\u003c/var\u003e\"\n }\n }\n\nReplace:\n\n- `LABEL_KEY` with a key of the environment label.\n- `LABEL_VALUE` with a new value for the environment label.\n\nExample: \n\n // PATCH https://composer.googleapis.com/v1/\n // ?{name=projects/*/locations/*/environments/*}\n // &updateMask.fieldPaths=labels\n\n {\n \"labels\": {\n \"owner\": \"engineering-team\",\n \"env\": \"production\"\n }\n }\n\n**Remove all labels**\n\nTo remove all labels, include `labels` in the `updateMask` query parameter\nand do not provide the replacement value.\n\n**Update individual labels**\n\nTo update a label or add a new label to existing labels, include\n`labels.LABEL_KEY` in the `updateMask` query parameter and provide a\nreplacement in the request body. \n\n // PATCH https://composer.googleapis.com/v1/\n // ?{name=projects/*/locations/*/environments/*}\n // &updateMask=labels.\u003cvar translate=\"no\"\u003eLABEL_KEY\u003c/var\u003e\n\n {\n \"labels\":{\n \"\u003cvar translate=\"no\"\u003eLABEL_KEY\u003c/var\u003e\": \"\u003cvar translate=\"no\"\u003eLABEL_VALUE\u003c/var\u003e\"\n }\n }\n\nReplace:\n\n- `LABEL_KEY` with a key of the environment label.\n- `LABEL_VALUE` with a new value for the environment label.\n\nExample: \n\n // PATCH https://composer.googleapis.com/v1/\n // ?name=projects/example-project/locations/\n // us-central1/environments/example-environment\n // &updateMask=labels.owner,labels.env\n\n {\n \"labels\": {\n \"owner\": \"engineering-team\",\n \"env\": \"production\"\n }\n }\n\n**Remove individual labels**\n\nTo remove labels, include `labels.LABEL_KEY` in the `updateMask` query\nparameter and do not provide the replacement value.\n\nTerraform\n\nTo create an environment with default parameters is a specified location,\nedit the `labels` block in your Terraform configuration and run\n`terraform apply`. \n\n resource \"google_composer_environment\" \"example\" {\n name = \"example-environment\"\n region = \"us-central1\"\n\n labels = {\n \u003cvar translate=\"no\"\u003eLABEL_KEY\u003c/var\u003e = \"\u003cvar translate=\"no\"\u003eLABEL_VALUE\u003c/var\u003e\"\n }\n\n }\n\nReplace:\n\n- `LABEL_KEY` with the environment label key that you want to create or update. To remove labels, delete their fields.\n- `LABEL_VALUE` with the environment label value.\n\nExample: \n\n resource \"google_composer_environment\" \"example\" {\n name = \"example-environment\"\n region = \"us-central1\"\n\n labels = {\n owner = \"engineering-team\"\n env = \"production\"\n }\n }\n\nView labels in reports\n\nAfter the labels for your environment propagate to billing reports, you can break down billing costs based on these labels:\n\n1. [View Cloud Billing reports](/billing/docs/how-to/reports#getting_started) for your\n Cloud Billing account.\n\n2. On the **Reports** page:\n\n 1. Click **Show filters**.\n 2. In the **Filters** dialog, expand the **Labels** section.\n 3. [Filter the displayed data](/billing/docs/how-to/reports#filters) based on keys and values of your environment labels.\n\nWhat's next\n\n- [Cloud Composer pricing](/composer/pricing)"]]