gcloud compute disks snapshot Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud compute disks snapshot - create snapshots of Compute Engine persistent disks
- SYNOPSIS
gcloud compute disks snapshotDISK_NAME[DISK_NAME…][--async][--chain-name=CHAIN_NAME][--csek-key-file=FILE][--description=DESCRIPTION][--guest-flush][--labels=[KEY=VALUE,…]][--snapshot-names=SNAPSHOT_NAME,[…]][--storage-location=LOCATION][--region=REGION|--zone=ZONE][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
gcloud compute disks snapshotcreates snapshots of persistentdisks. Snapshots are useful for backing up data, copying a persistent disk, andeven, creating a custom image. Snapshots can be created from persistent diskseven while they are attached to running instances. Once created, snapshots maybe managed (listed, deleted, etc.) viagcloud computesnapshots.Refer to the Snapshot best practices guide.https://cloud.google.com/compute/docs/disks/snapshot-best-practices
gcloud compute disks snapshot waits until the operation returns a status of
READYorFAILED, or reaches the maximum timeout, andreturns the last known details of the snapshot.Note: To create snapshots, the following IAM permissions are necessary
,compute.disks.createSnapshot,compute.snapshots.create, andcompute.snapshots.get.compute.zoneOperations.get- EXAMPLES
- To create a snapshot named
snapshot-testof a persistent disk namedtestin zoneus-central1-a, run:gcloudcomputediskssnapshottest--zone=us-central1-a--snapshot-names=snapshot-test--description="This is an example snapshot" - POSITIONAL ARGUMENTS
DISK_NAME[DISK_NAME…]- Names of the disks to operate on.
- FLAGS
--async- Return immediately, without waiting for the operation in progress to complete.
--chain-name=CHAIN_NAME- Create the new snapshot in the snapshot chain labeled with the specified name.The chain name must be 1-63 characters long and comply with RFC1035. Use thisflag only if you are an advanced service owner who needs to create separatesnapshot chains, for example, for chargeback tracking. When you describe yoursnapshot resource, this field is visible only if it has a non-empty value.
--csek-key-file=FILE- Path to a Customer-Supplied Encryption Key (CSEK) key file that maps ComputeEngine resources to user managed keys to be used when creating, mounting, ortaking snapshots of disks.
If you pass
-as value of the flag, the CSEK is read from stdin.Seehttps://cloud.google.com/compute/docs/disks/customer-supplied-encryptionfor more details. --description=DESCRIPTION- Text to describe the snapshots being created.
--guest-flush- Create an application-consistent snapshot by informing the OS to prepare for thesnapshot process.
--labels=[KEY=VALUE,…]- List of label KEY=VALUE pairs to add.
Keys must start with a lowercase character and contain only hyphens(
-), underscores (_), lowercase characters, andnumbers. Values must contain only hyphens (-), underscores(_), lowercase characters, and numbers. --snapshot-names=SNAPSHOT_NAME,[…]- Names to assign to the created snapshots. Without this option, the name of eachsnapshot will be a random 12-character alphanumeric string that starts with aletter. The values of this option run parallel to the disks specified. Forexample,
gcloudcomputediskssnapshotmy-disk-1my-disk-2my-disk-3--snapshot-namessnapshot-1,snapshot-2,snapshot-3
will result in
my-disk-1being snapshotted assnapshot-1,my-disk-2assnapshot-2, andso on. The name must match the(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)regular expression, whichmeans it must start with an alphabetic character followed by one or morealphanumeric characters or dashes. The name must not exceed 63 characters andmust not contain special symbols. All characters must be lowercase. --storage-location=LOCATION- Google Cloud Storage location, either regional or multi-regional, where snapshotcontent is to be stored. If absent, a nearby regional or multi-regional locationis chosen automatically.
- At most one of these can be specified:
--region=REGION- Region of the disks to operate on. If not specified, you might be prompted toselect a region (interactive mode only).
To avoid prompting when this flag is omitted, you can set the
property:compute/regiongcloudconfigsetcompute/regionREGIONA list of regions can be fetched by running:
gcloudcomputeregionslistTo unset the property, run:
gcloudconfigunsetcompute/regionAlternatively, the region can be stored in the environment variable
.CLOUDSDK_COMPUTE_REGION --zone=ZONE- Zone of the disks to operate on. If not specified and the
property isn't set, you mightbe prompted to select a zone (interactive mode only).compute/zoneTo avoid prompting when this flag is omitted, you can set the
property:compute/zonegcloudconfigsetcompute/zoneZONEA list of zones can be fetched by running:
gcloudcomputezoneslistTo unset the property, run:
gcloudconfigunsetcompute/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
- These variants are also available:
gcloudalphacomputediskssnapshotgcloudbetacomputediskssnapshot
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-22 UTC.