I needed the ability to clean up old Amazon Web Services EBS snapshots. I didn’t want to deal with providing credentials beyond what are already set up. Here’s an easy command to make this happen.
user@computer:$ ec2-describe-snapshots | sort -r -k 5 | sed 1,6d | awk '{print "Deleting snapshot: " $2}; system("ec2-delete-snapshot " $2)'
Change the second value in the sed command from 6 to however many snapshots you wish to keep. It will delete all others.
About ipaul
My name is Paul Hassinger, the founder of ipaul.com. I have been an avid user of computers since a child. I started when I was about 10 years old working on an Atari computer. Since then, I grew and have had exposure to all types of technologies. I started using FIDONet on a BBS as a child and grew to the Internet. My first graphical world wide web experience was in 1993 using Mosaic. Over time I've worked with both small and large computing systems even maintaining systems serving millions of users on some of the largest social networking sites. I hope to use this blog to capture what I've learned over the years and what I do in my daily life so that others and myself may find the information useful.
Hi Paul,
Check out the snapshot manager tool that you can download for free! It’ll automatically take snapshots of your volumes and roll them weekly, monthly, yearly.
http://www.valtira.com/page/1/valtira-blog-announcing-snapshot-manager.jsp
-Morgan