- NAME
-
- gcloud beta compute disks update-kms-key - update the KMS key of a Hyperdisk or Persistent Disk
- SYNOPSIS
-
-
gcloud beta compute disks update-kms-keyDISK_NAME[--kms-key=KMS_KEY:--kms-keyring=KMS_KEYRING--kms-location=KMS_LOCATION--kms-project=KMS_PROJECT] [--region=REGION|--zone=ZONE] [GCLOUD_WIDE_FLAG …]
-
- DESCRIPTION
-
(BETA)gcloud beta compute disks update-kms-keyupdates the KMS key of a Compute Engine Persistent or Hyperdisk Disk by rotating it to the primary version of the key or to the primary version of a new KMS key. - EXAMPLES
- To change the KMS key of a disk named
example-disk-1to the primary version, run:gcloud beta compute disks update-kms-key example-disk-1 --zone = us-central1-aTo change the KMS key of a disk named
example-disk-2to a new KMS key named example-key in a key ring named example-key-ring in the global scope, run:gcloud beta compute disks update-kms-key example-disk-2 --zone = us-central1-a --kms-key = example-key --kms-keyring = example-key-ring --kms-location = global - POSITIONAL ARGUMENTS
-
-
DISK_NAME - Name of the disk to operate on.
-
- FLAGS
-
- Key resource - The Cloud KMS (Key Management Service) cryptokey that will be used to protect the disk. The 'Compute Engine Service Agent' service account must hold permission 'Cloud KMS CryptoKey Encrypter/Decrypter'. The arguments in this group can be used to specify the attributes of this resource.
-
--kms-key=KMS_KEY - ID of the key or fully qualified identifier for the key.
To set the
kms-keyattribute:- provide the argument
--kms-keyon the command line.
This flag argument must be specified if any of the other arguments in this group are specified.
- provide the argument
-
--kms-keyring=KMS_KEYRING - The KMS keyring of the key.
To set the
kms-keyringattribute:- provide the argument
--kms-keyon the command line with a fully specified name; - provide the argument
--kms-keyringon the command line.
- provide the argument
-
--kms-location=KMS_LOCATION - The Google Cloud location for the key.
To set the
kms-locationattribute:- provide the argument
--kms-keyon the command line with a fully specified name; - provide the argument
--kms-locationon the command line; - provide the argument
--regionon the command line.
- provide the argument
-
--kms-project=KMS_PROJECT - The Google Cloud project for the key.
To set the
kms-projectattribute:- provide the argument
--kms-keyon the command line with a fully specified name; - provide the argument
--kms-projecton the command line; - set the property
core/project.
- provide the argument
- At most one of these can be specified:
-
--region=REGION - Region of the disk to operate on. If not specified, you might be prompted to
select a region (interactive mode only).
To avoid prompting when this flag is omitted, you can set the
property:compute/regiongcloud config set compute/region REGIONA list of regions can be fetched by running:
gcloud compute regions listTo unset the property, run:
gcloud config unset compute/regionAlternatively, the region can be stored in the environment variable
.CLOUDSDK_COMPUTE_REGION -
--zone=ZONE - Zone of the disk to operate on. 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 update-kms-keygcloud alpha compute disks update-kms-keygcloud preview compute disks update-kms-key
gcloud beta compute disks update-kms-key
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-05-27 UTC.

