- INFORMATION
-
gcloud beta compute disks bulk set-labelsis not available in universe domainuniverse. - NAME
-
- gcloud beta compute disks bulk set-labels - add or remove labels on multiple Compute Engine disks
- SYNOPSIS
-
-
gcloud beta compute disks bulk set-labels(--source=SOURCE|--disks=[DISK_NAME,…]--labels=[KEY=VALUE,…]) [--zone=ZONE] [GCLOUD_WIDE_FLAG …]
-
- DESCRIPTION
-
(BETA)gcloud beta compute disks bulk set-labelsallows you to add or remove labels on multiple Compute Engine disks in a single zone. Labels are key-value pairs that help you organize your Google Cloud resources.You can specify the disks and their labels in two ways:
1. By providing a JSON file using the
--sourceflag. Each request in the JSON list must specify the disknameandlabels, and may optionally includelabel_fingerprintfor optimistic concurrency control.2. By providing a list of disk names using the
--disksflag and the labels to apply using the--labelsflag. - EXAMPLES
-
To set the labels
env=productionandteam=sreondisk-1anddisk-2in zoneus-central1-a, run:gcloud beta compute disks bulk set-labels --zone=us-central1-a --disks=disk-1,disk-2 --labels=env=production,team=sreTo clear all labels on
disk-3anddisk-4in zoneeurope-west1-bprovide an empty value to --labels, run:gcloud beta compute disks bulk set-labels --zone=europe-west1-b --disks=disk-3,disk-4 --labels=''To set labels based on a JSON file named
disk_labels.json, run:Example `disk_labels.json` content:
[ { "name": "disk-1", "labels": { "env": "production", "team": "sre" }, "label_fingerprint": "42WmSpB8rSM=" }, { "name": "disk-2", "labels": { "env": "production", "team": "sre" } } ]
gcloud beta compute disks bulk set-labels --zone=us-central1-a --source=disk_labels.json ```To clear all labels on
disk-3anddisk-4in zoneeurope-west1-bprovide an empty labels value in the JSON file, run:Example `disk_labels.json` content:
[ { "name": "disk-3", "labels": {} }, { "name": "disk-4", "labels": {} } ]
gcloud beta compute disks bulk set-labels --zone=europe-west1-b --source=disk_labels.json - REQUIRED FLAGS
-
-
Exactly one of these must be specified:
--source=SOURCE- Path to a JSON file containing a list of disk label update requests. Each request object must specify "name" and "labels", and may optionally include "label_fingerprint".
-
Or at least one of these can be specified:
--disks=[DISK_NAME,…]-
Comma-separated list of disk names to update.
This flag argument must be specified if any of the other arguments in this group are specified.
--labels=[KEY=VALUE,…]-
List of label KEY=VALUE pairs to set on all specified disks.
This flag argument must be specified if any of the other arguments in this group are specified.
-
Exactly one of these must be specified:
- OPTIONAL FLAGS
-
--zone=ZONE-
Zone of the disk to update labels. If not specified and the
property isn't set, you might be prompted to select a zone (interactive mode only).compute/zoneTo avoid prompting when this flag is omitted, you can set the
property:compute/zonegcloud config set compute/zone ZONEA list of zones can be fetched by running:
gcloud compute zones listTo unset the property, run:
gcloud config unset compute/zoneAlternatively, the zone can be stored in the environment variable
.CLOUDSDK_COMPUTE_ZONE
- GCLOUD WIDE FLAGS
-
These flags are available to all commands:
--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.Run
$ gcloud helpfor details. - NOTES
-
This command is currently in beta and might change without notice. These
variants are also available:
gcloud compute disks bulk set-labelsgcloud alpha compute disks bulk set-labelsgcloud preview compute disks bulk set-labels
gcloud beta compute disks bulk set-labels
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-07-14 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-07-14 UTC."],[],[]]