Compute

Introducing scheduled snapshots for Compute Engine persistent disk

From web hosting to databases, workloads running on Compute Engine need a reliable, convenient and automatic way to create periodic snapshots for disks of VM instances. We are excited to announce that starting today, scheduled snapshots are now available in beta. This feature lets you create automated snapshots, as well as manage snapshot retention. It is designed to reduce errors and save time, so you can focus on initiatives that create value for your business.

You can use this feature by first defining a snapshot schedule, which supports frequencies by hours, days and weeks. For example, you can create a schedule that says “Create a snapshot every six hours,” or “Create a snapshot every Monday, Wednesday and Friday of each week.” Scheduled snapshots also mean you no longer need to manage snapshot cleanup yourself. You can define the retention policy within the same schedule, and the system will automatically delete the snapshots based on your defined retention policy.

The snapshot schedule can be applied to a single disk, or multiple disks within the same region, so you can create scheduled snapshots at scale.

You can also use the latest storage location feature for snapshots when defining the snapshot schedules.

Using the scheduled snapshots feature

You can create scheduled snapshots via the API, in the CLI (gcloud) and through the GCP Developer Console. Here’s how to get started.

In this gcloud example, a snapshot schedule is created in the europe-west1 region to generate snapshots every six hours, then delete them after 15 days:

  $ gcloud beta compute resource-policies create-snapshot-schedule hourly-schedule --description="create every 6 hours with 15 days retention"  --start-time=04:00 --hourly-schedule=6 --max-retention-days=15 --region=europe-west1

and then attach the “hourly-schedule” to existing disk d1 in europe-west1-b zone:


  $ gcloud beta compute disks add-resource-policies d1 --resource-policies=hourly-schedule --zone=europe-west1-b

Or you can specify a snapshot schedule while creating a new disk.

You can also create and manage your automated snapshots using the Developer Console. As you can see in the screenshot below, simply go to your “Snapshots” tab in Compute Engine to create and manage your snapshot schedules in the “Snapshot schedules” tab.
1. snapshot.png

Here is an example of how the same schedule in the CLI above would look in the Developer Console, once you create a schedule through the “Create snapshot schedule” button on the top.

2. create a snapshot.png

Navigate to the “Disks” tab to attach snapshot schedules to one or more disks. You can attach schedules to existing disks in the disk details view, or apply a schedule while creating a new disk. The screenshot below shows where to choose the snapshot schedule when creating a disk.

3. create a disk.png

To learn more about this feature and other best practices for managing your VMs, check out our talk from Next ’18. With the scheduled snapshots feature, you can focus on building creative applications without inventing your own tools for disk snapshots. Try it today.