How to Find and Delete Old EBS Snapshots

Reduce AWS storage costs by cleaning up old EBS snapshots. Learn how to find and delete outdated EBS snapshots to optimize your cloud resources.

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

Amazon Elastic Block Store (EBS) snapshots are static copies of your block data that house all the information necessary to restore your data to a new EBS volume. 

With some basic snapshot maintenance, you can significantly reduce your spending on AWS storage costs. 

In this guide, we’ll talk about how you can find old EBS snapshots and delete or archive them to lower your AWS costs.

Blink Automation: Detect and Remove Old EBS Snapshots with Slack Approval
AWS + Slack
Try This Automation

Understanding EBS Snapshots

EBS snapshots offer teams the ability to back up their EBS volumes and easily create a new volume with point-in-time data.

Because snapshots are created incrementally, an initial snapshot will include all the data on the disk, and subsequent snapshots will only store the blocks on the volume that have changed since the prior snapshot. Unchanged data is not stored, but referenced using the previous snapshot.

Currently, standard snapshot storage is billed at $0.05/GB per month. Archive storage is much lower at $0.0125/GB per month . To put those numbers in context, if you are using standard storage for 1 TB of snapshot data for a year, it costs $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 EBS Snapshots

To delete one or multiple disk snapshots, you can use either the AWS console or the AWS 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.

Finding and Deleting Old EBS Snapshots Using the AWS Console

If you want to delete snapshots using the AWS 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 Amazon EC2 console.
  2. Click on Snapshots in the navigation.
  3. You can review the details of specific snapshots to find ones you want to delete.
  4. Choose the snapshot you want to delete and click Actions.
  5. Click Delete snapshot to remove the snapshot.

While this method is simple, if you want to be able to apply filters with more flexibility, the AWS CLI might be a better option.

Finding and Deleting Old EBS Snapshots Using the AWS CLI

By using the AWS CLI, you are able to search for specific types of snapshots.

  1. First, use this describe-snapshots command to get a list of all the public snapshots. By adding a JMESPath expression, you can query the data to output snapshots created before a given date.
aws ec2 describe-snapshots --query
"Snapshots[?(StartTime<=`2020-03-31`)].[SnapshotId]" --output text
  1. If you want to search for old snapshots using tags, you can add a filter to the command. In this example, we are filtering using the Team tag for only snapshots owned by the “ATeam”.
aws ec2 describe-snapshots --filter Name=tag:Team,Values=ATeam
--query "Snapshots[?(StartTime<=`2020-03-31`)].[SnapshotId]" --output text
  1. Now that you have a list of all old snapshots, or snapshots relating to a certain tag, you can use the following command to delete the snapshots:
  delete-snapshot
--snapshot-id <value>

As we mentioned earlier, snapshots are incremental and if you delete a snapshot that has data referenced by another snapshot, that data will be transferred. Because of this, you might not see as dramatic reductions in storage as you expect since that data is still stored. Still, if there are block data changes that were captured by snapshots that are no longer relevant, deleting those will save you space.

Archiving snapshots is also a way to potentially lower your costs, if you want to, for example, retain the last snapshot from a project that has ended or been paused. Archived snapshots are stored at a much lower cost than standard snapshots, but they are bigger files than incremental snapshots since they will include all of the data that they reference. 

To assess if archiving makes more sense and will lower your storage, you can refer to this AWS guide on archiving best practices.

Cleaning Up Old EBS Snapshots with Blink

While it’s easy to delete snapshots using either the CLI or the console, doing this task regularly means 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 run this automation regularly to check for unneeded EBS snapshots.

Blink Automation: Detect Old AWS Snapshots and Delete Them After Approval
Blink Automation: Detect Old AWS Snapshots and Delete Them After Approval

When this automation runs, it executes the following actions:

  1. Gets old EBS snapshots.
  2. Asks for approval to delete them via Slack.
  3. If approved, deletes the old EBS snapshots.

You can import this automation from the Blink library and customize it however you like. For example, you could add conditional logic based on how you want to manage your data.

In Blink, you can also create automations from scratch to meet your team’s unique needs using the hundreds of drag-and-drop actions available from a wide range of tools.

Get started with Blink today to see how easy automation can be.

Expert Tip