Standard disk snapshots help you to periodically back up data from your Persistent Disk and Google Cloud Hyperdisk.
You can view, list, and delete disk snapshots. 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 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. 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.
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
To get the permissions that you need to manage standard snapshots, 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 manage standard snapshots. To see the exact permissions that are required, expand the Required permissions section:
Required permissionsThe following permissions are required to manage standard snapshots:
compute.snapshots.list
on the project compute.snapshots.get
on the snapshot compute.snapshots.delete
on the snapshot compute.snapshots.delete
on the snapshot compute.snapshots.list
on the project compute.storageAdmin
on the project (for accessing all standard snapshots) compute.disks.create
on the project to share with compute.snapshots.create
on the source project compute.disks.createSnapshot
on the source diskYou might also be able to get these permissions with custom roles or other predefined roles.
View the standard snapshots in a project or locationYou can view or list the standard snapshots in a project or location by using the gcloud CLI, Google Cloud console, or the REST.
ConsoleIn the Google Cloud console, go to the Snapshots page.
On the Snapshots tab, you can see the standard snapshots for the current project.
Optional. Narrow your results with the filter_list Filter field. Enter a property name or value in the Filter field, or choose from the available properties.
To see a list of all snapshots available to you in a particular project, use the gcloud compute snapshots list
command.
gcloud compute snapshots list --project=PROJECT_ID
(Preview) To see a list of regionally scoped snapshots available to you in a particular project, use the gcloud compute snapshots list
command and specify the region.
gcloud compute snapshots list --region=REGION_NAME
To see a list of globally scoped snapshots available to you in a particular project, use the gcloud compute snapshots list
command and include the --global
flag.
gcloud compute snapshots list --global
Replace the following:
PROJECT_ID
: Optional. Replace with the project ID. If you omit this flag, then the current project is used. You can set the default project for your session by using the gcloud CLI command gcloud config set project PROJECT_ID
.REGION_NAME
: The name of the region that you want to view snapshots for.To see a list of all snapshots available to you in a particular project, make a GET
request to the snapshots.list
method and specify "aggregated".
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/aggregated/snapshots
(Preview) To see a list of regionally scoped snapshots available to you in a particular project, make a GET
request to the snapshots.list
method and specify the region.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION_NAME/snapshots
To see a list of globally scoped snapshots available to you in a particular project, make a GET
request to the snapshots.list
method and specify "global".
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/snapshots
Replace the following:
PROJECT_ID
: The project ID.REGION_NAME
: The name of the region that you want to view snapshots for.You can view the list of standard snapshots for a disk by using the Google Cloud console, gcloud CLI,or REST.
ConsoleIn the Google Cloud console, go to the Snapshots page.
On the Snapshots tab, a list of all the standard snapshots in the project appears.
Narrow the results by source disk:
Enter Source disk:
in the filter_list Filter field, or click the Filter field and then choose the value Source disk
from the Properties list.
Select the name of the disk from the Values list that appears next to Source disk:
in the Filter field.
The snapshots displayed in the console now shows all standard snapshots for the specified disk.
If you don't see the name of a disk in the Values list, then in the Filter field next to Source disk:
, type in the first few letters of the source disk's name to change the list of values that you see.
List the standard snapshots for a disk with the gcloud compute snapshots list
command and the --filter
argument.
List the standard snapshots for a zonal disk:
gcloud compute snapshots list --filter="sourceDisk:projects/PROJECT_ID/zones/SOURCE_ZONE/disks/DISK_NAME
List the standard snapshots for a regional disk:
gcloud compute snapshots list --filter=sourceDisk:projects/PROJECT_ID/regions/SOURCE_REGION/disks/DISK_NAME
Replace the following:
PROJECT_ID
: the ID of the project.SOURCE_ZONE
: (Zonal disks only) the name of the zone for the disk, for example, us-west1-a
.SOURCE_REGION
: (Regional disks only) the name of the region for the disk, for example, us-west1
.DISK_NAME
: the name of the disk, for example, disk-1
.List the standard snapshots for a zonal or regional disk with a GET
request to the snapshots.list
method.
Use the filter=sourceDisk
query parameter to specify the name of the disk.
List the standard snapshots for a zonal disk:
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/snapshots?filter=sourceDisk:'https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/SOURCE_ZONE/disks/DISK_NAME'
List the standard snapshots for a regional disk:
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/snapshots?filter=sourceDisk:'https://www.googleapis.com/compute/v1/projects/PROJECT_ID/regions/SOURCE_REGION/disks/DISK_NAME'
Replace the following:
PROJECT_ID
: the ID of the project.SOURCE_ZONE
: (Zonal disks only) the name of the zone for the disk, for example, us-west1-a
.SOURCE_REGION
: (Regional disks only) the name of the region for the disk, for example, us-west1
.DISK_NAME
: the name of the source disk, for example disk-1
.Retrieve detailed information about a standard snapshot, such as its creation time, source disk, and size by using the Google Cloud console, Google Cloud CLI, or REST.
ConsoleIn the Google Cloud console, go to the Snapshots page.
On the Snapshots tab, view the list of snapshots in the project.
In the Name column, click the name of the standard snapshot. The Snapshot details page for the selected snapshot appears, showing its properties.
To view information about a globally scoped standard snapshot, use the gcloud compute snapshots describe
command.
gcloud compute snapshots describe SNAPSHOT_NAME
(Preview) To view information about a regionally scoped standard snapshot, use the gcloud compute snapshots describe
command and specify the region.
gcloud compute snapshots describe SNAPSHOT_NAME --regions=REGION_NAME
Replace the following:
SNAPSHOT_NAME
: The name of the standard snapshot.REGION_NAME
: The name of the region that your snapshot is scoped to.To view information about a globally scoped standard snapshot, make a GET
request to the snapshots.get
method.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/snapshots/SNAPSHOT_NAME
(Preview) To view information about a regionally scoped standard snapshot, make a GET
request to the snapshots.get
method and specify the region.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION_NAME/snapshots/SNAPSHOT_NAME
Replace the following:
PROJECT_ID
: The name of the project containing the standard snapshot.SNAPSHOT_NAME
: The name of the standard snapshot.REGION_NAME
: The name of the region that your snapshot is scoped to.Compute Engine uses differential snapshots so that each snapshot contains only the data that has changed since the previous snapshot. Because subsequent snapshots might require information stored in a previous snapshot, keep in mind that deleting a snapshot does not necessarily delete all the data on the snapshot.
To learn more about snapshot deletion, see Snapshot deletion.
ConsoleGo to the Snapshots page in the Google Cloud console.
Select one or more snapshots that you want to delete.
At the top of the Snapshots page, click Delete.
To delete a globally scoped snapshot, use the gcloud compute snapshots delete
command.
gcloud compute snapshots delete SNAPSHOT_NAME
(Preview) To delete a regionally scoped snapshot, use the gcloud compute snapshots delete
command and specify the region name.
gcloud compute snapshots delete SNAPSHOT_NAME --regions=REGION_NAME
Replace the following:
To delete a globally scoped snapshot, make a DELETE
request to the snapshots.delete
method.
DELETE https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/snapshots/SNAPSHOT_NAME
(Preview) To delete a regionally scoped snapshot, make a DELETE
request to the snapshots.delete
method and specify the region.
DELETE https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION_NAME/snapshots/SNAPSHOT_NAME
Replace the following:
Compute Engine uses differential snapshots so that each snapshot contains only the data that has changed since the previous snapshot. Because subsequent snapshots might require information stored in a previous snapshot, deleting a snapshot does not necessarily delete all the data on the snapshot.
To learn more about snapshot deletion, see Snapshot deletion.
You can delete a number of snapshots based on a given filter. For more information on how to use filters with the gcloud CLI, see gcloud CLI topic filters.
To delete the snapshots, use a combination of the gcloud compute snapshots list
command with a given filter, and the gcloud compute snapshots delete
command with xargs
.
gcloud compute snapshots list --filter="EXPRESSION" --uri | xargs gcloud compute snapshots delete
Replace EXPRESSION
with a gcloud CLI topic filter.
For example, --filter="creationTimestamp<'2023-12-31'"
deletes all snapshots created before December 31, 2023.
You can use this procedure to move data from a disk in one project to a disk in a different project within the same organization.
gcloudCreate a standard snapshot in the destination project by using the gcloud compute snapshots create
command. For example, to create a snapshot of a zonal Persistent Disk or Hyperdisk, use the following command:
gcloud compute snapshots create SNAPSHOT_NAME \ --source-disk https://www.googleapis.com/compute/v1/projects/SOURCE_PROJECT_ID/zones/ZONE/disks/SOURCE_DISK_NAME \ --project DESTINATION_PROJECT_ID
Replace the following:
In the destination project, create a zonal or regional disk that's based on the snapshot by using the gcloud compute disks create
command:
gcloud compute disks create DISK_NAME \ --source-snapshot SNAPSHOT_NAME \ --project DESTINATION_PROJECT_ID
Replace the following:
Create a standard snapshot in the destination project by calling the snapshots.insert
method. For example, to take a snapshot of a zonal Persistent Disk or Hyperdisk, make the following 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 }
Replace the following:
In the destination project, create a zonal or regional disk that's based on the snapshot by using the zonal disks.insert
method or the regional regionDisks.insert
method.
For example, to create a zonal disk, make the following request:
POST https://compute.googleapis.com/compute/v1/projects/DESTINATION_PROJECT_ID/zones/DESTINATION_ZONE/disks { "name": DISK_NAME "sourceSnapshot": SNAPSHOT_NAME }
Replace the following:
To get a list of snapshots available to you, see View the standard snapshots in a project or location.
Share a snapshot across projects in different organizationsYou can use this procedure to share a standard snapshot in a project in one organization with a different project in another organization.
gcloudIn the source project, create a disk that's based on the snapshot by using the gcloud compute disks create
command.
gcloud compute disks create DISK_NAME \ --source-snapshot SNAPSHOT_NAME \ --project SOURCE_PROJECT_ID \ --zone ZONE
Replace the following:
This disk is a temporary disk that is created only to copy the snapshot across organizations.
In the destination project, create a snapshot by using the gcloud compute snapshots create
command.
For example, to create a snapshot using the zonal disk created in the first step, use the following command:
gcloud compute snapshots create SNAPSHOT_NAME \ --source-disk https://www.googleapis.com/compute/v1/projects/SOURCE_PROJECT_ID/zones/ZONE/disks/DISK_NAME \ --project DESTINATION_PROJECT_ID
Replace the following:
To get a list of snapshots available to you, see View the standard snapshots in a project or location.
Delete the temporary disk created in the first step using the gcloud compute disks delete
command.
gcloud compute disks delete DISK_NAME \ --project SOURCE_PROJECT_ID --zone ZONE
Replace the following:
In the source project, create a zonal or regional disk that's based on the snapshot by using the zonal disks.insert
method.
For example, to create a zonal disk, make the following request:
POST https://compute.googleapis.com/compute/v1/projects/SOURCE_PROJECT_ID/zones/SOURCE_ZONE/disks { "name": DISK_NAME "sourceSnapshot": SNAPSHOT_NAME }
Replace the following:
This disk is a temporary disk that is created only to copy the snapshot across organizations.
Create a snapshot in the destination project by calling the snapshots.insert
method.
For example, to create a snapshot using the zonal disk created in the first step, use the following command:
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/DISK_NAME }
Replace the following:
Delete the temporary disk created in the first step using the disks.delete
method.
DELETE https://compute.googleapis.com/compute/v1/projects/SOURCE_PROJECT_ID/zones/SOURCE_ZONE/disks/DISK_NAME
Replace the following:
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