File: //snap/google-cloud-cli/396/help/man/man1/gcloud_compute_disks_snapshot.1
.TH "GCLOUD_COMPUTE_DISKS_SNAPSHOT" 1
.SH "NAME"
.HP
gcloud compute disks snapshot \- create snapshots of Compute Engine persistent disks
.SH "SYNOPSIS"
.HP
\f5gcloud compute disks snapshot\fR \fIDISK_NAME\fR [\fIDISK_NAME\fR\ ...] [\fB\-\-async\fR] [\fB\-\-chain\-name\fR=\fICHAIN_NAME\fR] [\fB\-\-csek\-key\-file\fR=\fIFILE\fR] [\fB\-\-description\fR=\fIDESCRIPTION\fR] [\fB\-\-guest\-flush\fR] [\fB\-\-labels\fR=[\fIKEY\fR=\fIVALUE\fR,...]] [\fB\-\-snapshot\-names\fR=\fISNAPSHOT_NAME\fR,[...]] [\fB\-\-storage\-location\fR=\fILOCATION\fR] [\fB\-\-region\fR=\fIREGION\fR\ |\ \fB\-\-zone\fR=\fIZONE\fR] [\fIGCLOUD_WIDE_FLAG\ ...\fR]
.SH "DESCRIPTION"
\fBgcloud compute disks snapshot\fR creates snapshots of persistent disks.
Snapshots are useful for backing up data, copying a persistent disk, and even,
creating a custom image. Snapshots can be created from persistent disks even
while they are attached to running instances. Once created, snapshots may be
managed (listed, deleted, etc.) via \f5gcloud compute snapshots\fR.
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
\f5READY\fR or \f5FAILED\fR, or reaches the maximum timeout, and returns the
last known details of the snapshot.
Note: To create snapshots, the following IAM permissions are necessary
\f5\fIcompute.disks.createSnapshot\fR\fR, \f5\fIcompute.snapshots.create\fR\fR,
\f5\fIcompute.snapshots.get\fR\fR, and \f5\fIcompute.zoneOperations.get\fR\fR.
.SH "EXAMPLES"
To create a snapshot named \f5snapshot\-test\fR of a persistent disk named
\f5test\fR in zone \f5us\-central1\-a\fR, run:
.RS 2m
$ gcloud compute disks snapshot test \-\-zone=us\-central1\-a \e
\-\-snapshot\-names=snapshot\-test \e
\-\-description="This is an example snapshot"
.RE
.SH "POSITIONAL ARGUMENTS"
.RS 2m
.TP 2m
\fIDISK_NAME\fR [\fIDISK_NAME\fR ...]
Names of the disks to operate on.
.RE
.sp
.SH "FLAGS"
.RS 2m
.TP 2m
\fB\-\-async\fR
Return immediately, without waiting for the operation in progress to complete.
.TP 2m
\fB\-\-chain\-name\fR=\fICHAIN_NAME\fR
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 this
flag only if you are an advanced service owner who needs to create separate
snapshot chains, for example, for chargeback tracking. When you describe your
snapshot resource, this field is visible only if it has a non\-empty value.
.TP 2m
\fB\-\-csek\-key\-file\fR=\fIFILE\fR
Path to a Customer\-Supplied Encryption Key (CSEK) key file that maps Compute
Engine resources to user managed keys to be used when creating, mounting, or
taking snapshots of disks.
If you pass \f5\-\fR as value of the flag, the CSEK is read from stdin. See
https://cloud.google.com/compute/docs/disks/customer\-supplied\-encryption for
more details.
.TP 2m
\fB\-\-description\fR=\fIDESCRIPTION\fR
Text to describe the snapshots being created.
.TP 2m
\fB\-\-guest\-flush\fR
Create an application\-consistent snapshot by informing the OS to prepare for
the snapshot process.
.TP 2m
\fB\-\-labels\fR=[\fIKEY\fR=\fIVALUE\fR,...]
List of label KEY=VALUE pairs to add.
Keys must start with a lowercase character and contain only hyphens (\f5\-\fR),
underscores (\f5_\fR), lowercase characters, and numbers. Values must contain
only hyphens (\f5\-\fR), underscores (\f5_\fR), lowercase characters, and
numbers.
.TP 2m
\fB\-\-snapshot\-names\fR=\fISNAPSHOT_NAME\fR,[...]
Names to assign to the created snapshots. Without this option, the name of each
snapshot will be a random 12\-character alphanumeric string that starts with a
letter. The values of this option run parallel to the disks specified. For
example,
.RS 2m
gcloud compute disks snapshot my\-disk\-1 my\-disk\-2 my\-disk\-3 \-\-snapshot\-names snapshot\-1,snapshot\-2,snapshot\-3
.RE
will result in \f5my\-disk\-1\fR being snapshotted as \f5snapshot\-1\fR,
\f5my\-disk\-2\fR as \f5snapshot\-2\fR, and so on. The name must match the
\f5(?:[a\-z](?:[\-a\-z0\-9]{0,61}[a\-z0\-9])?)\fR regular expression, which
means it must start with an alphabetic character followed by one or more
alphanumeric characters or dashes. The name must not exceed 63 characters and
must not contain special symbols. All characters must be lowercase.
.TP 2m
\fB\-\-storage\-location\fR=\fILOCATION\fR
Google Cloud Storage location, either regional or multi\-regional, where
snapshot content is to be stored. If absent, a nearby regional or
multi\-regional location is chosen automatically.
.TP 2m
At most one of these can be specified:
.RS 2m
.TP 2m
\fB\-\-region\fR=\fIREGION\fR
Region of the disks 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
\f5\fIcompute/region\fR\fR property:
.RS 2m
$ gcloud config set compute/region REGION
.RE
A list of regions can be fetched by running:
.RS 2m
$ gcloud compute regions list
.RE
To unset the property, run:
.RS 2m
$ gcloud config unset compute/region
.RE
Alternatively, the region can be stored in the environment variable
\f5\fICLOUDSDK_COMPUTE_REGION\fR\fR.
.TP 2m
\fB\-\-zone\fR=\fIZONE\fR
Zone of the disks to operate on. If not specified and the
\f5\fIcompute/zone\fR\fR property isn't set, you might be prompted to select a
zone (interactive mode only).
To avoid prompting when this flag is omitted, you can set the
\f5\fIcompute/zone\fR\fR property:
.RS 2m
$ gcloud config set compute/zone ZONE
.RE
A list of zones can be fetched by running:
.RS 2m
$ gcloud compute zones list
.RE
To unset the property, run:
.RS 2m
$ gcloud config unset compute/zone
.RE
Alternatively, the zone can be stored in the environment variable
\f5\fICLOUDSDK_COMPUTE_ZONE\fR\fR.
.RE
.RE
.sp
.SH "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 \fB$ gcloud help\fR for details.
.SH "NOTES"
These variants are also available:
.RS 2m
$ gcloud alpha compute disks snapshot
.RE
.RS 2m
$ gcloud beta compute disks snapshot
.RE