Skip to content

sam-k3nny/google-compute-snapshot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 

Repository files navigation

Google (gcloud) Compute Engine Snapshot

Overview

  • Hats off to https://github.com/jacksegal for creating this script initially
  • Takes a daily snapshot of a compute instance disk without any user input
  • Pass in the instance name
  • Deletes all snapshots that are older than 7 days (default)

Prerequisites

Recommended Setup

  • Load the script on to the VM (do not run it from a remote source)

  • I use cronic - http://habilis.net/cronic/

  • Run the script from a cron job. Note this must be done as a user that has access to gcloud compute:

      0 05 * * * /usr/local/bin/cronic /path/to/snapshot.sh [INSTANCE_NAME] | tee /path/to/snapshot.log
    
  • Add the /var/log/cron directory folder to logrotate: /etc/logrotate.d/cron

    /var/log/cron/*.log { daily missingok rotate 14 compress notifempty create 640 root adm sharedscripts }

Downloading the script and opening in Windows?

If you download the script and open it on a Windows machine, that may add windows character's to the file: jacksegal#1.

About

Automated creation of google compute disk snapshots and deletion of old ones

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%