How are admins managing their EC2 EBS’s and Snapshots?

I use ec2-consistent-snapshot ( http://alestic.com/2009/09/ec2-consistent-snapshot ) to take my snapshots (on RHEL/CentOS derived Amazon’s Linux) – it is written in Perl and uses the API directly. You specify the volumes you want to snapshot and it allows you to add a description.

(In AWS console you can add tags if you need finer grained control, but for a simple backup that might not be necessary, and isn’t yet supported by the Perl module used above (Net::Amazon::EC2)).

The above script does not delete snapshots (only create new ones – consistently (i.e. it can freeze the disk/db before the snapshot). Since it is fairly commonly used and I couldn’t find a compatible Perl script to delete old snapshots I wrote my own ( http://www.thatsgeeky.com/2011/06/rotating-ebs-snapshots-ec2-prune-snapshots/ ). It does the job (grandfather-father-son rotation) well and uses the same dependencies and parameters as the above script.

Of course, both are set to run via Cron.

(In theory, it should be easy enough to hook some similar scripts (there are those written in PHP and Ruby for instance) up to a database, and maintain your own log of the volumes and snapshots taken – each snapshot has a unique id so as long as record that, any further in-house organization should be easily possible. [However, for backup purposes, the volume-id and date is often sufficient])

Don’t use the CLI tools – they are written in Java and are ridiculously slow compared to any direct API implementations.

Leave a Comment