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
Wayne Robinson discovered that EC2 sometimes limits the rate at which you can delete snapshots, and submitted code for a new
--delete-delayoption that tells
ec2-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:
sudo add-apt-repository -y ppa:alestic sudo apt-get update sudo apt-get install -y ec2-expire-snapshots
This example expires EBS snapshots for a volume, preserving the first daily snapshot for the last week, and and the first snapshot each month for the last year. There is also an implicit saving of the most recent snapshot:
ec2-expire-snapshots --keep-first-daily 7 --keep-first-monthly 12 vol-1234678
There are many more options and different approaches to expiring snapshots.
Please read the documentation for more details on usage and how to set up your AWS credentials.