Detect useless Snapshots and Volumes in the Amazon EC2 Cloud

Do you know that problem? You started and stopped server instances on the Amazon Cloud, performed snapshots of instances or EBS volumes, and after some weeks or months you find the EC2 console totally cluttered. There are lots of unattached volumes with completely meaningless IDs and dozens of nameless snapshots, for which you even don’t know what they actually contain. Having all that data lying around does not only compromise your usage experience in the web-console, but also increments the probability of data leakage and accidental loss. And even worse, you need to pay for that mess and invest some time to regularly clean it up – manually and carefully to avoid the deletion of unique data or backups that might actually be needed for recovery purposes in the future.

We at SecludIT wrote an open-source script to address this problem and published it in on our CloudyScripts site. The script identifies two types of resources that might be considered for cleanup:

  • Snapshots: when the number of snapshots that exist for the same EBS volume exceed a certain configurable number, you can safely delete the oldest ones
  • Volumes: when a volume is not linked to any instance and is not used since more than a day, it is probably useless

We are aware that there are very complete AWS cost control and optimization solutions on the market (e.g. Cloudyn or Cloudrows). However, in case you simply want to clean up your account from time to time without registering for a new service, the script should be quite helpful. I run it every week now!

Let us know if you consider this useful and if you have propositions to improve it!

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s