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.
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:
- Go to the Snapshots page in the Google Cloud console.
- Pick one or more snapshots you wish to remove.
- 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.
- First, use this “gcloud compute snapshots list” command to get a list of all the snapshots before a given date.
- Next, you can use the following command to delete the snapshots:
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.
When you create a free Blink account, you can use no-code steps to run automated checks for unneeded GCP snapshots. Build the automation in minutes, set it to run on a schedule, and lower your GCP costs.