Create archive and standard disk snapshots (original) (raw)

Skip to main content

Create archive and standard disk snapshots

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 alsoshare snapshotsacross projects.

Before you begin

Console

When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.

gcloud

  1. Install 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.
  2. Set a default region and zone.

Terraform

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.

  1. Install the Google Cloud CLI.
  2. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
  3. 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.

Go

To 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.

  1. Install the Google Cloud CLI.
  2. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
  3. 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.

Java

To 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.

  1. Install the Google Cloud CLI.
  2. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
  3. 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.js

To 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.

  1. Install the Google Cloud CLI.
  2. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
  3. 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.

Python

To 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.

  1. Install the Google Cloud CLI.
  2. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
  3. 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.

REST

To 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, seeAuthenticate for using REST in the Google Cloud authentication documentation.

Required roles and permissions

To get the permissions that you need to create and manage snapshots, ask your administrator to grant you the following IAM roles on the project:

For more information about granting roles, see Manage access to projects, folders, and organizations.

These predefined roles contain the permissions required to create and manage snapshots. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to create and manage snapshots:

You might also be able to get these permissions with custom roles or other predefined roles.

Prepare for creating snapshots

To prepare for creating snapshots of Persistent Disk or Hyperdisk volumes, complete the following steps:

Create a snapshot of a disk

The steps to create a snapshot of a disk depend on whether you're creating a snapshot of a zonal disk or regional disk.

Create a snapshot of a zonal disk

Console

  1. Go to the Create a Snapshot page in the Google Cloud console.
    Go to the Create a Snapshot page
  2. Enter a snapshot Name.
  3. Select 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.
  4. Optional: Enter a Description of the snapshot.
  5. Under Source disk, select the existing disk that you want to create a snapshot of.
  6. 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:
    1. Choose the type of storage location that you want for your snapshot.
      • Choose Multi-regional for higher availability at a higher cost.
      • ChooseRegional snapshots for more control over the physical location of your data at a lower cost.
    2. In the Select location field, select the specific region or multi-region that you want to use. To use the region or multi-region that is closest to your source disk, select Based on disk's location.
  7. Click Create to create the snapshot.

gcloud

You can create your snapshot in the storage location policy defined by yoursnapshot settings or using an alternative storage location of your choice. For more information, seeChoose your snapshot storage location.

Replace the following:

Terraform

To create a snapshot of the zonal Persistent Disk volume, use thegoogle_compute_snapshotresource.

To learn how to apply or remove a Terraform configuration, seeBasic Terraform commands.

Go

Go

Before trying this sample, follow the Go setup instructions in theCompute Engine quickstart using client libraries. For more information, see theCompute Engine Go API reference documentation.

To authenticate to Compute Engine, set up Application Default Credentials. For more information, seeSet up authentication for client libraries.

Java

Java

Before trying this sample, follow the Java setup instructions in theCompute Engine quickstart using client libraries. For more information, see theCompute Engine Java API reference documentation.

To authenticate to Compute Engine, set up Application Default Credentials. For more information, seeSet up authentication for client libraries.

Node.js

Node.js

Before trying this sample, follow the Node.js setup instructions in theCompute Engine quickstart using client libraries. For more information, see theCompute Engine Node.js API reference documentation.

To authenticate to Compute Engine, set up Application Default Credentials. For more information, seeSet up authentication for client libraries.

Python

Python

Before trying this sample, follow the Python setup instructions in theCompute Engine quickstart using client libraries. For more information, see theCompute Engine Python API reference documentation.

To authenticate to Compute Engine, set up Application Default Credentials. For more information, seeSet up authentication for client libraries.

REST

You can create your snapshot in the storage location policy defined by yoursnapshot settings or using an alternative storage location of your choice. For more information, seeChoose your snapshot storage location.

Replace the following:

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.

Console

  1. Go to the Create a Snapshot page in the Google Cloud console.
    Go to the Create a Snapshot page
  2. Enter a snapshot Name.
  3. Select 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.
  4. Optional: Enter a Description of the snapshot.
  5. Under Source disk, select the existing disk that you want to create a snapshot of.
  6. 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:
    1. Choose the type of storage location that you want for your snapshot.
      • Choose Multi-regional for higher availability at a higher cost.
      • ChooseRegional snapshots for more control over the physical location of your data at a lower cost.
    2. In the Select location field, select the specific region or multi-region that you want to use. To use the region or multi-region that is closest to your source disk, select Based on disk's location.
  7. Click Create to create the snapshot.

gcloud

You can create a snapshot either by using the source disk's data or its replica recovery checkpoint.

From disk data

You can create a snapshot from your disk's data using the storage location policy defined by yoursnapshot settings or using an alternative storage location of your choice. For more information, seeChoose your snapshot storage location.

Replace the following:

From checkpoint

You can create your snapshot using thereplica recovery checkpointof 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:

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 ofREADY, FAILED, or reaches the maximum timeout and returns the last known details of the snapshot.

Terraform

The Terraform provider for Google Cloud doesn't support creating a snapshot of a regional disk. To track this limitation, see theissue on GitHub.

Go

Go

Before trying this sample, follow the Go setup instructions in theCompute Engine quickstart using client libraries. For more information, see theCompute Engine Go API reference documentation.

To authenticate to Compute Engine, set up Application Default Credentials. For more information, seeSet up authentication for client libraries.

Java

Java

Before trying this sample, follow the Java setup instructions in theCompute Engine quickstart using client libraries. For more information, see theCompute Engine Java API reference documentation.

To authenticate to Compute Engine, set up Application Default Credentials. For more information, seeSet up authentication for client libraries.

Node.js

Node.js

Before trying this sample, follow the Node.js setup instructions in theCompute Engine quickstart using client libraries. For more information, see theCompute Engine Node.js API reference documentation.

To authenticate to Compute Engine, set up Application Default Credentials. For more information, seeSet up authentication for client libraries.

Python

Python

Before trying this sample, follow the Python setup instructions in theCompute Engine quickstart using client libraries. For more information, see theCompute Engine Python API reference documentation.

To authenticate to Compute Engine, set up Application Default Credentials. For more information, seeSet up authentication for client libraries.

REST

You can create a snapshot either by using the source disk's data or its replica recovery checkpoint.

From disk data

You can create a snapshot from your disk's data using the storage location policy defined by yoursnapshot settings or using an alternative storage location of your choice. For more information, seeChoose your snapshot storage location.

Replace the following:

From checkpoint

Alternatively, you can create your snapshot using thereplica recovery checkpointof 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 aPOST request to the snapshots.insert method. Exclude the sourceDisk parameter and instead include thesourceDiskForRecoveryCheckpoint 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:

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 2026-06-18 UTC.