How to Find and Remove Old GCP Disk Snapshots

Learn how to find and remove old GCP snapshots to lower your cloud costs. Follow the instructions in our step-by-step guide.

Patrick Londa
Author
Aug 23, 2022
 • 
 min read
Share this post

Google Cloud Platform (GCP) disk snapshots are copies of data contained on persistent disks connected to your instances. Snapshots house information about data held on that disk during a specific period. While the first snapshot includes all data on a disk, subsequent copies only contain information relevant to subsequent changes. If you don’t have a maintenance process in place, you could end up spending money on keeping unnecessary snapshots.

In this guide, we’ll talk about optimizing your GCP costs by finding and deleting old snapshots.

Blink Automation: Ensure Old GCP Disk Snapshots are Deleted if Not Required
GCP + Slack
Try This Automation

Understanding GCP Disk Snapshots

GCP disk snapshots are easier to create on a persistent disk and cost less than creating a full image. Snapshots can therefore help lower costs. Snapshots are created based on the last successful snapshot. Subsequent copies refer to the previous snapshot for any data that did not change.

The incremental nature of GCP disk snapshots helps organizations avoid getting billed for redundant information. That means deleting a GCP snapshot does not eliminate the information it contains. You would need to delete all GCP disk snapshots that used it as a reference to remove the data entirely.

The cost of snapshot storage can really add up if you aren’t monitoring it. Currently, regional and multi-regional snapshot storage is billed at $0.026 GB per month. Starting Oct. 1st, 2022, regional snapshot storage is doubling to $0.05 GB per month and multi-regional storage is increasing even more to $0.065 GB per month. So if you are storing 1 TB of snapshot data for a year, it costs $312, and is about to jump to $600.

Depending on your scale, paying for snapshot storage you don’t need can add up and contribute to your organization’s increasing cloud costs.

How to Find and Delete Old GCP Disk Snapshots

To delete one or multiple disk snapshots, you can use either the Google Cloud console or the gCloud CLI tool. Once you remove a snapshot, it gets marked as deleted. If a snapshot does not have other snapshots depending on it for data, it gets removed entirely. Otherwise, the information within the deleted snapshot gets moved to the next one in line, making it bigger.

Deleting Disk Snapshots Using the Google Cloud Console

If you want to delete snapshots using the Google Cloud console, you won’t be able to filter by snapshot age, but you can look at specific snapshots and delete them. The steps are pretty simple:

  1. Go to the Snapshots page in the Google Cloud console.
  2. Pick one or more snapshots you wish to remove.
  3. Click the Delete button at the top of the Snapshots page.

Deleting Disk Snapshots by Date Using the gCloud CLI

By using the gCloud CLI, you will be able to delete multiple snapshots for certain dates. You can list all your old GCP disk snapshots for a specific period and delete them by linking the list and delete command.

  1. First, use this “gcloud compute snapshots list” command to get a list of all the snapshots before a given date.
gcloud compute snapshots list --filter=
"creationTimestamp>'2022-08-01'" |
  1. Next, you can use the following command to delete the snapshots:
--uri xargs gcloud compute snapshots delete

Automating GCP Snapshot Clean Up with Blink

While it’s easy to delete snapshots using either the CLI or the console, doing this task regularly requires disruptive context-switching. If you want to run this type of check often, there’s a better way to do it.

With Blink, you can use no-code steps to run automated checks for unneeded GCP snapshots.

Blink Automation: Ensure Old Snapshots are Deleted if Not Required in GCP
Blink Automation: Ensure Old Snapshots are Deleted if Not Required in GCP

This GCP automation in the Blink library runs on a schedule that you can specify. When it runs, it does the following steps:

  1. Checks for snapshots created before a maximum number of days.
  2. Sends a report via email to a specified email address.

This is a simple automation you can import from the library and customize to your organization’s needs. For example, you can drag-and-drop new actions into the canvas or set up conditional logic.

Get started with Blink today and see how your organization can utilize automation with ease.

Expert Tip