Create and manage instant snapshots


This document explains how to create and manage instant snapshots. Instant snapshots capture the contents of a disk and can be used to create a new disk in minutes.

You can create an instant snapshot of a disk only if the disk is attached to a running virtual machine (VM) instance. The disk must also be attached in read-write mode.

Instant snapshots are stored in the same zone or region as their source disks and are not a replacement for standard snapshots, which offer off-site backup for disaster recovery. Learn about the other data protection options available in Compute Engine.

To access the data on an instant snapshot, use the instant snapshot to create a new disk.

If you want to copy an instant snapshot to another location, create a standard snapshot from the instant snapshot.

Before you begin

  • If you haven't already, set up authentication. Authentication is the process by which your identity is verified for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine as follows.

    Select the tab for how you plan to use the samples on this page:

    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, then initialize it by running the following command:

      gcloud init
    2. Set a default region and zone.

    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, then initialize it by running the following command:

      gcloud init

Restrictions

To ensure instant snapshots are suitable for your use case, review the limitations related to instant snapshots.

Create an instant snapshot of a Persistent Disk volume

Instant snapshots of zonal disks are stored in the same zone as the source disk. Likewise, instant snapshots of regional disks are stored in the same regions as the disk.

You can create an instant snapshot of a zonal or regional Persistent Disk volume using the gcloud CLI, Google Cloud console, or REST.

Console

  1. In the Google Cloud console, go to the VM instances page.

    Go to VM instances

  2. Select the project you want to work with.

  3. In the Name column, click the name of the VM attached to the disk you want to back up.

  4. In the Storage section, select a disk in one of the following ways:

    • To back up the VM's boot disk, in the Boot disk section, click the Name of the desired boot disk.
    • To back up an attached Persistent Disk volume, in the Additional disks section, click the Name of the desired attached Persistent Disk volume.
  5. To finish creating an instant snapshot, on the Create a snapshot page, do the following:

    1. In the Name field, enter a unique name to identify the instant snapshot.
    2. Optional: Add more details about the snapshot in the Description field.
    3. In the Type field, select Instant snapshot. The Location field is automatically set to the same zone or region as the disk.
    4. In the Snapshot source type field, verify that Disk is selected.
    5. Optional: To organize your project, add one or more labels.
    6. Click Create.

gcloud

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. To create an instant snapshot, use the gcloud beta compute instant-snapshots create command:

    Zonal disk

    gcloud beta compute instant-snapshots create INSTANT_SNAPSHOT_NAME \
       --source-disk=SOURCE_DISK_NAME \
       --zone=SOURCE_DISK_ZONE
    

    Replace the following:

    • INSTANT_SNAPSHOT_NAME: a unique name for the instant snapshot.
    • SOURCE_DISK_NAME: the name of the source disk.
    • SOURCE_DISK_ZONE: the zone of the source disk. The instant snapshot will be created in the same zone.

    Regional disk

    gcloud beta compute instant-snapshots create INSTANT_SNAPSHOT_NAME \
       --source-disk=SOURCE_DISK_NAME \
       --region=SOURCE_DISK_REGION
    

    Replace the following:

    • INSTANT_SNAPSHOT_NAME: a unique name for the instant snapshot.
    • SOURCE_DISK_NAME: the name of the source disk.
    • SOURCE_DISK_REGION: the region of the source disk. The instant snapshot will be created in the same region.

REST

To create an instant snapshot, make a POST request to the instantSnapshots.insert method.

  • Create an instant snapshot of a zonal disk:

    Specify the zone in the URL of the POST request. In the request body, specify a name for the new snapshot and the URL of the source disk.

     POST https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/DISK_ZONE/instantSnapshots
     {
        "name": "INSTANT_SNAPSHOT_NAME",
        "sourceDisk": "projects/PROJECT_ID/zones/DISK_ZONE/disks/SOURCE_DISK_NAME"
     }
     
    Replace the following with the corresponding values:

    • PROJECT_ID: the name of the project containing the disk.
    • DISK_ZONE: the zone where the disk is located. the instant snapshot will be created in this zone.
    • INSTANT_SNAPSHOT_NAME: a unique name for the instant snapshot.
    • SOURCE_DISK_NAME: the name of the source disk.
  • Create an instant snapshot of a regional disk:

    Specify the region in the URL of the POST request. Include the name and source disk of the new snapshot in the request body.

        POST https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/regions/DISK_REGION/instantSnapshots
           {
              "name": "INSTANT_SNAPSHOT_NAME",
              "sourceDisk": "projects/PROJECT_ID/regions/DISK_REGION/disks/SOURCE_DISK_NAME"
           }
     
    Replace the following in the request body with the corresponding values:

    • PROJECT_ID: the name of the project containing the disk.
    • DISK_REGION: the region where the source disk is located. The snapshot will be created in the same region.
    • INSTANT_SNAPSHOT_NAME: a unique name for the snapshot.
    • SOURCE_DISK_NAME: The name of the source disk.

Request response

If the POST request is successful, the response body will be an object that you can poll to get the status of the instant snapshot's creation. See Handling API responses for more information.

Restore an instant snapshot to a new Persistent Disk volume

To restore data backed up with an instant snapshot, create a new disk from the instant snapshot.

View the instant snapshots in a project or location

You can view the list of all instant snapshots in a project or location by using the gcloud CLI, Google Cloud console, or REST.

Console

  1. In the Google Cloud console, go to the Snapshots page.

    Go to the Snapshots page

  2. Click the Instant snapshots tab. The list of instant snapshots appears.

  3. Optional: Narrow your results with the Filter field. Enter a property name or value in the Filter field, or choose from the available properties.

gcloud

You can list the instant snapshots in a specific project or location with the gcloud beta compute instant-snapshots list command.

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. List all the snapshots in a project or the snapshots in a zone or region:

    • List all the instant snapshots in a particular project:

      gcloud beta compute instant-snapshots list --project=PROJECT_ID
      

      Replace PROJECT_ID with the ID of the project.

    • List the instant snapshots in a zone with the --zones argument:

      gcloud beta compute instant-snapshots list --zones=ZONE
      

      Replace ZONE with the name of the target zone.

    • List the regional instant snapshots in a region using the --regions argument:

      gcloud beta compute instant-snapshots list --regions=REGION
      

      Replace REGION: with the name of the target region.

REST

You can retrieve a list of the instant snapshots in a specific project or location.

  • List the snapshots in a project:

    Make a GET request to the instantSnapshots.aggregatedList method:

        GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/aggregated/instantSnapshots
     
    Replace PROJECT_ID with the ID of the project.

  • List the instant snapshots in a zone or region:

    Make a GET request to the instantSnapshots.list method.

    • List the instant snapshots in a zone:
        GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/SOURCE_ZONE//instantSnapshots
    
    Replace the following: - `PROJECT_ID`: the ID of the project. - `SOURCE_ZONE`: the target zone, for example, `us-west1-a`. + List the regional instant snapshots in a region:
        GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/regions/SOURCE_REGION/instantSnapshots
    

    Replace the following:

    • PROJECT_ID: the ID of the project.
    • SOURCE_REGION: the target region, for example, us-west1.

View the instant snapshots for a disk

You can view the list of instant snapshots for a disk by using the gcloud CLI, Google Cloud console, or REST.

Console

  1. In the Google Cloud console, go to the Snapshots page.

    Go to the Snapshots page

  2. Click the Instant snapshots tab. The list of all the instant snapshots in the project appears.

  3. Narrow the results by source disk:

    1. Enter Source disk: in the filter_list Filter field. Entering the source disk filter

      A list of disks with instant snapshots appears.

    2. Select the name of the disk from the Values list. The list of instant snapshots shows all instant snapshots for the disk.

      If you don't see the name of a disk in the filter_list Filter field, type in the first few letters of the disk's name to change the list of filtered options that you see.

gcloud

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. List the instant snapshots for a disk with the gcloud beta compute instant-snapshots list command and the --filter argument:

    • List the instant snapshots for a zonal disk:

      gcloud beta compute instant-snapshots list
      --filter="sourceDisk:projects/PROJECT_ID/zones/ZONE/disks/DISK_NAME
      

      Replace the following:

      • PROJECT_ID: the ID of the project.
      • ZONE: the name of the zone for the disk, for example, us-west1-a.
      • DISK_NAME: the name of the source disk, for example, disk-1.
    • List the instant snapshots for a regional disk:

      gcloud beta compute instant-snapshots list
         --filter=sourceDisk:projects/PROJECT_ID/regions/SOURCE_REGION/disks/DISK_NAME
      

    Replace the following:

    • PROJECT_ID: the ID of the project.
    • SOURCE_REGION: the name of the region for the disk, for example, us-west1.
    • DISK_NAME: the name of the disk, for example, disk-1.

REST

List the instant snapshots for a zonal or regional disk with a GET request to the instantSnapshots.list method.

Use the filter=sourceDisk query parameter to specify the name of the disk.

  • List the instant snapshots for a zonal Persistent Disk volume:

    GET https://compute.googleapis.com/compute/beta/projects/<var>PROJECT_ID</var>/zones/<var>SOURCE_ZONE/</var>/instantSnapshots?filter=sourceDisk:'https://www.googleapis.com/compute/beta/projects/<var>PROJECT_ID</var>/zones/<var>SOURCE_ZONE</var>/disks/<var>DISK_NAME</var>'
    

    Replace the following:

    • PROJECT_ID: the ID of the project.
    • SOURCE_ZONE: the target zone, for example, us-west1-a.
    • DISK_NAME: the name of the source disk, for example, disk-1.
  • List the instant snapshots for a regional Persistent Disk volume:

    GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/regions/SOURCE_REGION//instantSnapshots?filter=sourceDisk:'https://www.googleapis.com/compute/beta/projects/PROJECT_ID/regions/SOURCE_REGION/disks/DISK_NAME'

    Replace the following:

    • PROJECT_ID: the ID of the project.
    • SOURCE_REGION: the target region, for example, us-west1.
    • DISK_NAME: the name of the source disk, for example, disk-1.

View information about an instant snapshot

Retrieve detailed information about an instant snapshot, such as its location, source disk, and size by using the gcloud CLI, Google Cloud console, or REST.

Console

  1. In the Google Cloud console, go to the Snapshots page.

    Go to the Snapshots page

  2. Click the Instant snapshots tab. The list of instant snapshots appears.

  3. In the Name column, click the name of the instant snapshot. The Instant snapshot details page for the selected snapshot appears, showing its properties.

gcloud

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. To view information about an instant snapshot, use the gcloud beta compute instant-snapshots describe command.

    • If the snapshot is of a zonal disk, specify the zone with the --zone flag:

      gcloud beta compute instant-snapshots describe INSTANT_SNAPSHOT_NAME  \
         --zone=ZONE
      

      Replace the following with the corresponding values:

      • INSTANT_SNAPSHOT_NAME: the name of the instant snapshot.
      • ZONE: the zone where the instant snapshot was created, for example, us-west1-a.
    • If the snapshot is of a regional disk, specify the region with the --region flag:

      gcloud beta compute instant-snapshots describe INSTANT_SNAPSHOT_NAME \
      --region=REGION
      

      Replace the following with the corresponding values:

      • INSTANT_SNAPSHOT_NAME: the name of the instant snapshot.
      • REGION: the region where the snapshot was created, for example, us-central1.

REST

The API method request you use depends on whether you're working with a regional or zonal instant snapshot.

Zonal instant snapshot

Make a GET request to the instantSnapshots.get method by specifying the zone in the request:

GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/instantSnapshots/INSTANT_SNAPSHOT_NAME

Replace the following with the corresponding values:

  • PROJECT_ID: the name of the project containing the instant snapshot.
  • ZONE: the zone where the instant snapshot was created.
  • INSTANT_SNAPSHOT_NAME: the name of the instant snapshot.

Regional instant snapshot

Make a GET request to the instantSnapshots.get method by specifying the region in the request:

GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/regions/REGION/instantSnapshots/INSTANT_SNAPSHOT_NAME

Replace the following with the corresponding values:

  • PROJECT_ID: the name of the project containing the instant snapshot.
  • REGION: the region where the instant snapshot was created.
  • INSTANT_SNAPSHOT_NAME: the name of the instant snapshot.

Delete an instant snapshot

You can delete an instant snapshot by using the gcloud CLI, Google Cloud console, or REST.

Console

  1. In the Google Cloud console, go to the Snapshots page.

    Go to the Snapshots page

  2. Click the Instant snapshots tab.

  3. Select one more snapshots to delete.

  4. At the top of the Snapshots page, click Delete.

gcloud

Delete an instant snapshot with the gcloud beta compute instant-snapshots delete command, specifying either the source zone or the source region.

  • Delete an instant snapshot of a zonal disk:

    gcloud beta compute instant-snapshots delete INSTANT_SNAPSHOT_NAME \
        --zone=ZONE
     

    Replace the following with the corresponding values:

    • ZONE: the name of the zone.
    • INSTANT_SNAPSHOT_NAME: the name of the instant snapshot.
  • Delete an instant snapshot of a regional disk:

    gcloud beta compute instant-snapshots delete INSTANT_SNAPSHOT_NAME \
       --region=REGION
    

    Replace the following:

    • REGION: the name of the region.
    • INSTANT_SNAPSHOT_NAME: the name of the instant snapshot.

REST

Delete an instant snapshot with a DELETE request to the instantSnapshots.delete method:

  • Delete an instant snapshot of zonal disk:

    DELETE https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/instantSnapshots/INSTANT_SNAPSHOT_NAME
    

    Replace the following with the corresponding values:

    • PROJECT_ID: the ID of the project.
    • ZONE: the name of the zone.
    • INSTANT_SNAPSHOT_NAME: the name of the instant snapshot.
  • Delete an instant snapshot of a regional disk:

    DELETE https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/regions/REGION/instantSnapshots/INSTANT_SNAPSHOT_NAME

    Replace the following with the corresponding values:

    • PROJECT_ID: the ID of the project.
    • REGION: the name of the region.
    • INSTANT_SNAPSHOT_NAME: the name of the instant snapshot.

Change the storage location of an instant snapshot

An instant snapshot is always stored in the same location as the source disk. You can't make an instant snapshot accessible from a different zone or region. Instead, you can create a standard snapshot from the instant snapshot and use the standard snapshot.

Learn how to create a standard snapshot from an instant snapshot.

Troubleshooting

See Troubleshooting instant snapshots to resolve problems you encounter working with instant snapshots.