Skip to content

Instantly share code, notes, and snippets.

@mikejk8s
Created November 2, 2017 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikejk8s/1034b8775f6e65af6f5963b256ba089d to your computer and use it in GitHub Desktop.
Save mikejk8s/1034b8775f6e65af6f5963b256ba089d to your computer and use it in GitHub Desktop.
Google Compute Snapshotter
#!/bin/bash
# loop through all disks within this project and create a snapshot
gcloud compute disks list --format='value(name,zone)'| while read DISK_NAME ZONE; do
gcloud compute disks snapshot $DISK_NAME --snapshot-names gcs-$DISK_NAME-$(date "+%Y-%m-%d-%s") --zone $ZONE
done
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment