GCP VM - ghdrako/doc_snipets GitHub Wiki

Resource:

Backup disk

####Snapshot Snapshots incrementally back up data from your persistent disks. After you create a snapshot to capture the current state of the disk, you can use it to restore that data to a new disk. You can create snapshots from disks even while they are attached to running virtual machine (VM) instances.

gcloud compute snapshots create SNAPSHOT_NAME \
    --source-disk SOURCE_DISK \
    --source-disk-zone SOURCE_DISK_ZONE

gcloud compute snapshots delete SNAPSHOT_NAME
gcloud compute snapshots list --project PROJECT_ID
gcloud compute snapshots describe SNAPSHOT_NAME
# create snapshot disk in different project
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

Creating scheduled snapshots for persistent disk

1 create snapshot schedule

2 Attach schedule to disk