Stay organized with collections Save and categorize content based on your preferences.
Create standard snapshots to periodically back up data from zonal and regional Persistent Disk and Google Cloud Hyperdisk volumes.
You can create snapshots from disks even while they are attached to running instances. Snapshots are, by default, global resources, so you can use them to restore data to a new disk or VM within the same project. For additional data protection and cost management, you can control where you can use your snapshots to create new disks. To restrict the regions where your snapshots can restore data, you can create a regionally scoped snapshot and set allowed access locations (Preview). You can also share snapshots across projects.
Before you beginSelect the tab for how you plan to use the samples on this page:
ConsoleWhen you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloudInstall the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.To use the Terraform samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up authentication for a local development environment.
GoTo use the Go samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up authentication for a local development environment.
JavaTo use the Java samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up authentication for a local development environment.
Node.jsTo use the Node.js samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up authentication for a local development environment.
PythonTo use the Python samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up authentication for a local development environment.
RESTTo use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
To get the permissions that you need to create a standard snapshot, ask your administrator to grant you the following IAM roles on the project:
roles/compute.instanceAdmin.v1
)roles/iam.serviceAccountUser
)For more information about granting roles, see Manage access to projects, folders, and organizations.
These predefined roles contain the permissions required to create a standard snapshot. To see the exact permissions that are required, expand the Required permissions section:
Required permissionsThe following permissions are required to create a standard snapshot:
compute.snapshots.create
on the project compute.disks.createSnapshot
on the disk compute.snapshots.create
on the project compute.instances.useReadOnly
on the source VM compute.disks.createSnapshot
on the disk compute.snapshots.create
on the project compute.disks.createSnapshot
on the disk compute.snapshots.create
on the project compute.regionSnapshots.create
on the project compute.disks.useReadOnly
on the diskYou might also be able to get these permissions with custom roles or other predefined roles.
Prepare for creating snapshotsTo prepare for creating snapshots of Persistent Disk or Hyperdisk volumes, do the following:
Review Best practices for Compute Engine disk snapshots to prepare your disk for snapshotting.
If you want to customize the default storage location for all your new globally scoped snapshots, update the snapshot settings for your project. Google Cloud maintains a predefined default storage location value until you update the snapshot settings for the first time. This predefined location is the nearest multi-region to the source disk.
Read Create schedules for disk snapshots to learn about creating a snapshot schedule and attaching it to your disks. Backing up your disks regularly with scheduled snapshots can reduce the risk of unexpected data loss.
UPLOADING
status. For more information, see the table in Manually creating application consistent snapshots. Create a snapshot of Persistent Disk or Hyperdisk volume
The steps to create a snapshot of a disk depend on whether you're creating a snapshot of a zonal disk or regional disk.
Caution: If you try to create a snapshot from a disk and the snapshot creation process fails, you won't be able to delete the original disk volume until you clean up the failed snapshot and capture a clean snapshot. This failsafe helps to prevent the accidental deletion of source data in the event of an unsuccessful backup. Create a snapshot of a zonal disk ConsoleGo to the Create a Snapshot page in the Google Cloud console.
Go to the Create a Snapshot pageSelect a Snapshot type. The default is a STANDARD
snapshot, which is the best option for long-term back up and disaster recovery.
Choose Archive snapshot for more cost-efficient data retention.
In the Location section, choose your snapshot storage location.
The predefined or customized default location defined in your snapshot settings is automatically selected. Optionally, you can override the snapshot settings and store your snapshots in a custom storage location by doing the following:
Choose the type of storage location that you want for your snapshot.
You can create your snapshot in the storage location policy defined by your snapshot settings or using an alternative storage location of your choice. For more information, see Choose your snapshot storage location.
To create a snapshot in the predefined or customized default location configured in your snapshot settings, use the gcloud compute snapshots create
command.
gcloud compute snapshots create SNAPSHOT_NAME \ --source-disk-zone=SOURCE_ZONE \ --source-disk=SOURCE_DISK_NAME \ --snapshot-type=SNAPSHOT_TYPE
Alternatively, to override the snapshot settings and create a snapshot in a custom storage location, include the --storage-location
flag to indicate where to store your snapshot.
gcloud compute snapshots create SNAPSHOT_NAME \ --source-disk-zone=SOURCE_ZONE \ --source-disk=SOURCE_DISK_NAME \ --snapshot-type=SNAPSHOT_TYPE \ --storage-location=STORAGE_LOCATION
(Preview) To create a regionally scoped snapshot in an allowed region, include the --region
flag to indicate where to create your snapshot.
gcloud beta compute snapshots create SNAPSHOT_NAME \ --region=SNAPSHOT_SCOPE_REGION --source-disk=SOURCE_DISK_NAME \ --source-disk-zone=SOURCE_ZONE \ --snapshot-type=SNAPSHOT_TYPE
Replace the following:
STANDARD
snapshot is created.STORAGE_LOCATION: Optional: For globally scoped snapshots, the Cloud Storage multi-region or the Cloud Storage region where you want to store your snapshot. You can specify only one storage location.
Use the --storage-location
parameter only when you want to override the predefined or customized default storage location configured in your snapshot settings.
SNAPSHOT_SCOPE_REGION: Optional: For regionally scoped snapshots, the region that the snapshot is scoped to. If you include this parameter, you can't use the --storage-location
parameter. The STORAGE_LOCATION is automatically set to the SNAPSHOT_SCOPE_REGION.
gcloud compute snapshots create
command instead of the gcloud compute disks snapshot
command because it supports more features, such as creating snapshots in a project different from the source disk project. Terraform
To create a snapshot of the zonal Persistent Disk volume, use the google_compute_snapshot
resource.
To learn how to apply or remove a Terraform configuration, see Basic Terraform commands.
Go GoBefore trying this sample, follow the Go setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Go API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java JavaBefore trying this sample, follow the Java setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Java API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js Node.jsBefore trying this sample, follow the Node.js setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Node.js API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python PythonBefore trying this sample, follow the Python setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Python API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
RESTYou can create your snapshot in the storage location policy defined by your snapshot settings or using an alternative storage location of your choice. For more information, see Choose your snapshot storage location.
To create a snapshot in the predefined or customized default location configured in your snapshot settings, make a POST
request to the snapshots.insert
method:
POST https://compute.googleapis.com/compute/v1/projects/DESTINATION_PROJECT_ID/global/snapshots { "name": "SNAPSHOT_NAME", "sourceDisk": "projects/SOURCE_PROJECT_ID/zones/SOURCE_ZONE/disks/SOURCE_DISK_NAME", "snapshotType": "SNAPSHOT_TYPE" }
Alternatively, to override the snapshot settings and create a snapshot in a custom storage location, make a POST
request to the snapshots.insert
method and include the storageLocations
property in your request:
POST https://compute.googleapis.com/compute/v1/projects/DESTINATION_PROJECT_ID/global/snapshots { "name": "SNAPSHOT_NAME", "sourceDisk": "projects/SOURCE_PROJECT_ID/zones/SOURCE_ZONE/disks/SOURCE_DISK_NAME", "snapshotType": "SNAPSHOT_TYPE", "storageLocations": [ "STORAGE_LOCATION" ], }
(Preview) To create a regionally scoped snapshot in an allowed region, make a POST
request to the snapshots.insert
method and define the creation region:
POST https://compute.googleapis.com/compute/beta/projects/DESTINATION_PROJECT_ID/regions/SNAPSHOT_SCOPE_REGION/snapshots { "name": "SNAPSHOT_NAME", "sourceDisk": "projects/SOURCE_PROJECT_ID/zones/SOURCE_ZONE/disks/SOURCE_DISK_NAME", "snapshotType": "SNAPSHOT_TYPE" }
Replace the following:
STANDARD
snapshot is created.STORAGE_LOCATION: Optional: For globally scoped snapshots, the Cloud Storage multi-region or the Cloud Storage region where you want to store your snapshot. You can specify only one storage location.
Use the storageLocations
parameter only when you want to override the predefined or customized default storage location configured in your snapshot settings.
SNAPSHOT_SCOPE_REGION: Optional: For regionally scoped snapshots, the region that the snapshot is scoped to. If you include this parameter, you can't use the storageLocations
parameter. The STORAGE_LOCATION is automatically set to the SNAPSHOT_SCOPE_REGION.
snapshots.insert
method instead of the disks.createSnapshot
method because it supports more features, such as creating snapshots in a project different from the source disk project. Create a snapshot of a regional disk
You can create snapshots of your regional disk in one of the following ways:
After you prepare the disk, you can create a snapshot. When creating a snapshot of a regional disk, you must indicate the region where the source disk is located.
ConsoleGo to the Create a Snapshot page in the Google Cloud console.
Go to the Create a Snapshot pageSelect a Snapshot type. The default is a STANDARD
snapshot, which is the best option for long-term back up and disaster recovery.
Choose Archive snapshot for more cost-efficient data retention.
In the Location section, choose your snapshot storage location.
The predefined or customized default location defined in your snapshot settings is automatically selected. Optionally, you can override the snapshot settings and store your snapshots in a custom storage location by doing the following:
Choose the type of storage location that you want for your snapshot.
You can create a snapshot either by using the source disk's data or its replica recovery checkpoint.
From disk dataYou can create a snapshot from your disk's data using the storage location policy defined by your snapshot settings or using an alternative storage location of your choice. For more information, see Choose your snapshot storage location.
To create a snapshot in the predefined or customized default location configured in your snapshot settings, use the gcloud compute snapshots create
command.
gcloud compute snapshots create SNAPSHOT_NAME \ --source-disk-region=SOURCE_REGION \ --source-disk=SOURCE_DISK_NAME \ --snapshot-type=SNAPSHOT_TYPE
Alternatively, to override the snapshot settings and create a snapshot in a custom storage location, include the --storage-location
flag to indicate where to store your snapshot.
gcloud compute snapshots create SNAPSHOT_NAME \ --source-disk-region=SOURCE_REGION \ --source-disk=SOURCE_DISK_NAME \ --snapshot-type=SNAPSHOT_TYPE \ --storage-location=STORAGE_LOCATION
(Preview) To create a regionally scoped snapshot in an allowed region, include the --region
flag to indicate where to create your snapshot.
gcloud beta compute snapshots create SNAPSHOT_NAME \ --region=SNAPSHOT_SCOPE_REGION \ --source-disk=SOURCE_DISK_NAME \ --source-disk-region=SOURCE_REGION \ --snapshot-type=SNAPSHOT_TYPE
Replace the following:
STANDARD
snapshot is created.STORAGE_LOCATION: Optional: For globally scoped snapshots, the Cloud Storage multi-region or the Cloud Storage region where you want to store your snapshot. You can specify only one storage location.
Use the --storage-location
parameter only when you want to override the predefined or customized default storage location configured in your snapshot settings.
SNAPSHOT_SCOPE_REGION: Optional: For regionally scoped snapshots, the region that the snapshot is scoped to. If you include this parameter, you can't use the --storage-location
parameter. The STORAGE_LOCATION is automatically set to the SNAPSHOT_SCOPE_REGION.
gcloud compute snapshots create
command instead of the gcloud compute disks snapshot
command because it supports more features, such as creating snapshots in a project different from the source disk project. From checkpoint
You can create your snapshot using the replica recovery checkpoint of a degraded disk. Your snapshot gets created as long as your incomplete replica is available.
To create a snapshot using the replica recovery checkpoint, use the gcloud compute snapshots create
command . Include the --source-disk-for-recovery-checkpoint
flag to specify that you want to create the snapshot using a replica recovery checkpoint. Exclude the --source-disk
and --source-disk-region
parameters.
gcloud compute snapshots create SNAPSHOT_NAME \ --source-disk-for-recovery-checkpoint=SOURCE_DISK \ --source-disk-for-recovery-checkpoint-region=SOURCE_REGION \ --storage-location=STORAGE_LOCATION \ --snapshot-type=SNAPSHOT_TYPE
Replace the following:
DESTINATION_PROJECT_ID
: The ID of project in which you want to create the snapshot.SNAPSHOT_NAME
: A name for the snapshot.SOURCE_PROJECT_ID
: The project ID of the source disk whose checkpoint you want to use to create the snapshot.SOURCE_REGION
: The region of the source disk whose checkpoint you want to use to create the snapshot.SOURCE_DISK_NAME
: The name of the source disk whose checkpoint you want to use to create the snapshot.STORAGE_LOCATION
: Optional: The Cloud Storage multi-region or the Cloud Storage region where you want to store your snapshot. You can specify only one storage location.SNAPSHOT_TYPE
: The snapshot type, either STANDARD or ARCHIVE. If a snapshot type is not specified, a STANDARD snapshot is created.You can use replica recovery checkpoint to create a snapshot only on degraded disks. If you try to create a snapshot from a replica recovery checkpoint when the device is fully replicated, you see the following error message:
The device is fully replicated and should not create snapshots out of a recovery checkpoint. Please create regular snapshots instead.
The Google Cloud CLI waits until the operation returns a status of READY
, FAILED
, or reaches the maximum timeout and returns the last known details of the snapshot.
The Terraform provider for Google Cloud doesn't support creating a snapshot of a regional disk. To track this limitation, see the issue on GitHub.
Go GoBefore trying this sample, follow the Go setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Go API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java JavaBefore trying this sample, follow the Java setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Java API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js Node.jsBefore trying this sample, follow the Node.js setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Node.js API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python PythonBefore trying this sample, follow the Python setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Python API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
RESTYou can create a snapshot either by using the source disk's data or its replica recovery checkpoint.
From disk dataYou can create a snapshot from your disk's data using the storage location policy defined by your snapshot settings or using an alternative storage location of your choice. For more information, see Choose your snapshot storage location.
To create a snapshot in the predefined or customized default location configured in your snapshot settings, make a POST
request to the snapshots.insert
method:
POST https://compute.googleapis.com/compute/v1/projects/DESTINATION_PROJECT_ID/global/snapshots { "name": "SNAPSHOT_NAME", "sourceDisk": "projects/SOURCE_PROJECT_ID/regions/SOURCE_REGION/disks/SOURCE_DISK_NAME", "snapshotType": "SNAPSHOT_TYPE" }
Alternatively, to override the snapshot settings and create a snapshot in a custom storage location, make a POST
request to the snapshots.insert
method and include the storageLocations
property in your request:
POST https://compute.googleapis.com/compute/v1/projects/DESTINATION_PROJECT_ID/global/snapshots { "name": "SNAPSHOT_NAME", "sourceDisk": "projects/SOURCE_PROJECT_ID/regions/SOURCE_REGION/disks/SOURCE_DISK_NAME", "snapshotType": "SNAPSHOT_TYPE", "storageLocations": [ "STORAGE_LOCATION" ], }
(Preview) To create a regionally scoped snapshot in an allowed region, make a POST
request to the snapshots.insert
method and define the creation region:
POST https://compute.googleapis.com/compute/beta/projects/DESTINATION_PROJECT_ID/regions/SNAPSHOT_SCOPE_REGION/snapshots { "name": "SNAPSHOT_NAME", "sourceDisk": "projects/SOURCE_PROJECT_ID/regions/SOURCE_REGION/disks/SOURCE_DISK_NAME", "snapshotType": "SNAPSHOT_TYPE", }
Replace the following:
STANDARD
snapshot is created.STORAGE_LOCATION: Optional: For globally scoped snapshots, the Cloud Storage multi-region or the Cloud Storage region where you want to store your snapshot. You can specify only one storage location.
Use the storageLocations
parameter only when you want to override the predefined or customized default storage location configured in your snapshot settings.
SNAPSHOT_SCOPE_REGION: Optional: For regionally scoped snapshots, the region that the snapshot is scoped to. If you include this parameter, you can't use the storageLocations
parameter. The STORAGE_LOCATION is automatically set to the SNAPSHOT_SCOPE_REGION.
snapshots.insert
method instead of the disks.createSnapshot
method because it supports more features, such as creating snapshots in a project different from the source disk project. From checkpoint
Alternatively, you can create your snapshot using the replica recovery checkpoint of a degraded disk. Your snapshot gets created as long as your incomplete replica is available.
To create a snapshot using the replica recovery checkpoint, make a POST
request to the snapshots.insert
method. Exclude the sourceDisk
parameter and instead include the sourceDiskForRecoveryCheckpoint
parameter to specify that you want to create the snapshot using the checkpoint.
POST https://compute.googleapis.com/compute/v1/projects/DESTINATION_PROJECT_ID/global/snapshots { "name": "SNAPSHOT_NAME", "sourceDiskForRecoveryCheckpoint": "projects/SOURCE_PROJECT_ID/regions/SOURCE_REGION/disks/SOURCE_DISK_NAME", "storageLocations": "STORAGE_LOCATION", "snapshotType": "SNAPSHOT_TYPE" }
Replace the following:
DESTINATION_PROJECT_ID
: The ID of project in which you want to create the snapshot.SNAPSHOT_NAME
: A name for the snapshot.SOURCE_PROJECT_ID
: The project ID of the source disk whose checkpoint you want to use to create the snapshot.SOURCE_REGION
: The region of the source disk whose checkpoint you want to use to create the snapshot.SOURCE_DISK_NAME
: The name of the source disk whose checkpoint you want to use to create the snapshot.STORAGE_LOCATION
: Optional: The Cloud Storage multi-region or the Cloud Storage region where you want to store your snapshot. You can specify only one storage location.storageLocations
parameter only if you want to override the predefined or customized default storage location configured in your snapshot settings.SNAPSHOT_TYPE
: The snapshot type, either STANDARD or ARCHIVE. If a snapshot type is not specified, a STANDARD snapshot is created.You can use replica recovery checkpoint to create a snapshot only on degraded disks. If you try to create a snapshot from a replica recovery checkpoint when the device is fully replicated, you see the following error message:
The device is fully replicated and should not create snapshots out of a recovery checkpoint. Please create regular snapshots instead.What's next
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 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["Snapshots provide a way to back up data from Zonal Persistent Disk, Regional Persistent Disk, and Google Cloud Hyperdisk volumes, even while they are attached to running instances."],["Snapshots are global resources, meaning they can be used to restore data to a new disk or VM within the same project, and can also be shared across different projects."],["To create a snapshot, users must have specific IAM roles and permissions, such as Compute Instance Admin (v1) and Service Account User (v1), and depending on disk type, can utilize different create methods."],["Before creating snapshots, it's important to review best practices, consider customizing the default storage location, and learn about creating snapshot schedules for regular backups."],["Snapshots can be created using the Console, `gcloud` CLI, Terraform, or REST API, with the option to store them in a predefined default location or a custom storage location."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4