Whitepaper 'FinOps and cost management for Kubernetes'
Please consider giving OptScale a Star on GitHub, it is 100% open source. It would increase its visibility to others and expedite product development. Thank you!
Ebook 'From FinOps to proven cloud cost management & optimization strategies'
OptScale FinOps
OptScale — FinOps
FinOps overview
Cost optimization:
AWS
MS Azure
Google Cloud
Alibaba Cloud
Kubernetes
MLOps
OptScale — MLOps
ML/AI Profiling
ML/AI Optimization
Big Data Profiling
OPTSCALE PRICING
cloud migration
Acura — Cloud migration
Overview
Database replatforming
Migration to:
AWS
MS Azure
Google Cloud
Alibaba Cloud
VMWare
OpenStack
KVM
Public Cloud
Migration from:
On-premise
disaster recovery
Acura — DR & cloud backup
Overview
Migration to:
AWS
MS Azure
Google Cloud
Alibaba Cloud
VMWare
OpenStack
KVM

Reduce your AWS bill by eliminating orphaned and unused disk snapshots

Problem description

AWS volume snapshots, also known as EBS snapshots, are widely used to backup and restore data on Amazon EC2, being how important it is nowadays to stay protected. But, how are these snapshots charged? How much does it cost me to remain protected? Can I somehow reduce my AWS bill by removing unused resources? In this article, we will answer each of these questions with insightful answers.

Mismanaged cloud resources and unpredictable cloud bills are not a myth. IT leaders are facing this common problem on a daily basis. A lack of transparency could be one of the main obstacles, which precludes analyzing and optimizing the costs of your AWS cloud. Visibility is a key to optimization and having a clearly defined FinOps strategy in place aims to bring more transparency, prevent budget overruns, and identify wasted budget and idle resources, such as orphaned and unused disk snapshots.

How AWS volume snapshots are charged

EBS snapshots are charged on a gigabyte-per-month basis, thus an important takeaway here is to understand how they are generated, and how much storage they consume in reality.

AWS snapshots are stored incrementally. This means that the first snapshot of your instance is a full copy, and each additional snapshot is incremental, so only the changed parts, or deltas, of your EBS volume are stored.

Reduce-AWS-bill-by-cleaning-orphaned-snapshots

Let’s take a look at an example of this: here is a 200GB instance running in your account. The first snapshot that you create will also be 200GB, and you will be charged for this amount of data. If you have 205 GB of extra data, emulating a case in which the initial 200GB was not changed, the next time you create a snapshot, you will be charged for an additional 5GB of snapshot storage for the second snapshot.

Free cloud cost optimization for a lifetime

Why companies continue to pay after deleting an instance in AWS

The next thing to remember is that when an instance in AWS is deleted, the volume of this instance is also deleted, but the snapshots remain in the cloud. Therefore, they become orphaned and are often just lost among the others. However, you still have to pay for them.

As for all other AWS services, the pricing also varies from one region to another. The average price, however, is approximately $0.05 per GB-month of data stored. Some would say that this is not that much to pay, and he may be right, but here is where the main issue comes in – the more snapshots you have, the higher your bill becomes.

Obviously, the optimal solution to this issue is to have a policy available that would describe how you store and retain unused snapshots and scripts, to then find and clean them up.

How to find and delete orphaned and unused snapshots

The process of finding orphaned snapshots is a bit complex. The reason for the complexity is that you have not only to get the list of snapshots, but also to get the list of volumes/AMIs, and check whether the snapshots are linked or not to particular volumes and images.

From the AWS Console:

The AWS Console is pretty poor at identifying if a snapshot is related to any existing AMI or volume. For example, even if a volume is deleted from the cloud, the Volume ID field on the snapshots page will still have the original value, but still you can use the Snapshots page to remove unnecessary snapshots, as follows:

How to find and delete unused snapshots from AWS Console

From AWS CLI:

To get the list of snapshots not linked to any volume, do as follows:

ORPHANED_SNAPSHOT_IDS=$(comm -23 <(aws ec2 describe-snapshots --owner-ids $AWS-ACCOUNT-ID --query 'Snapshots[*].SnapshotId' --output text | tr '\t' '\n' | sort) <(aws ec2 describe-volumes --query 'Volumes[*].SnapshotId' --output text | tr '\t' '\n' | sort | uniq))

To get the list of snapshots not linked to any AMIs, do as follows:

ORPHANED_SNAPSHOT_IDS=$(comm -23 <(aws ec2 describe-snapshots --owner-ids $AWS_ACCOUNT_ID --query 'Snapshots[*].SnapshotId' --output text | tr '\t' '\n' | sort) <(aws ec2 describe-images --filters Name=state,Values=available --owners $AWS_ACCOUNT_ID --query "Images[*].BlockDeviceMappings[*].Ebs.SnapshotId" --output text | tr '\t' '\n' | sort | uniq))

Use regular shell loop to remove the snapshots for volumes and AMIs:

for snapshot_id in $ORPHANED_SNAPSHOT_IDS; do echo "aws ec2 delete-snapshot --snapshot-id $snapshot_id"; done

Conclusion

Dozens of AWS volume snapshots are typically created by a company engineering team on a daily basis. EBS snapshots have become a popular choice to backup and restore data on Amazon EC2. But some challenges may occur while deleting instances, and many companies continue to pay for them. 

The ways of identifying and deleting orphaned and unused snapshots, as described in the article, will help you avoid wastage, achieve optimization goals, reduce your cloud bill, and take the initial steps towards implementing a FinOps methodology in your company.

Free cloud cost optimization. Lifetime →  Sign up

Elastic IP addresses on Amazon EC2 are free of charge, but only if the following rules are applied. Get more details about the rules of using Elastic IP addresses on Amazon EC2, and start saving your company’s cloud budget → ‘How to release Elastic IPs on Amazon EC2.’

Enter your email to be notified about new and relevant content.

Thank you for joining us!

We hope you'll find it usefull

You can unsubscribe from these communications at any time. Privacy Policy

News & Reports

FinOps and MLOps

A full description of OptScale as a FinOps and MLOps open source platform to optimize cloud workload performance and infrastructure cost. Cloud cost optimization, VM rightsizing, PaaS instrumentation, S3 duplicate finder, RI/SP usage, anomaly detection, + AI developer tools for optimal cloud utilization.

FinOps, cloud cost optimization and security

Discover our best practices: 

  • How to release Elastic IPs on Amazon EC2
  • Detect incorrectly stopped MS Azure VMs
  • Reduce your AWS bill by eliminating orphaned and unused disk snapshots
  • And much more deep insights

Optimize RI/SP usage for ML/AI teams with OptScale

Find out how to:

  • see RI/SP coverage
  • get recommendations for optimal RI/SP usage
  • enhance RI/SP utilization by ML/AI teams with OptScale