The ec2-expire-snapshots program can be used to expire EBS snapshots in Amazon EC2 on a regular schedule that you define. It can be used as a companion to ec2-consistent-snapshot or independently.
There have been two recent submissions to the code from the community that provide new command line options in the latest version (v0.11) of ec2-expire-snapshots.
-
Wayne Robinson discovered that EC2 sometimes limits the rate at which you can delete snapshots, and submitted code for a new
--delete-delayoption that tellsec2-expire-snapshotsto pause for N seconds between each EBS snapshot deletion. -
Anthony Tonns uses EC2’s new feature to copy EBS snapshots from one region to another for redundancy, and found that Amazon does not associate snapshots from the same EBS volume in the source region with the same source volume in the target region. Anthony came up with the idea of putting the source volume id in a tag and submitted code for a new
--volume-id-in-tagoption that lets you specify the tag name.
Thanks also to varunwy for submitting a patch a while back to clean up some dependencies in the package installation.
On Ubuntu, you can install ec2-expire-snapshots from the Alestic PPA using: