Creating snapshots on AWS with ruby and awstools

Since the recent outage, I’ve been looking for simple scripts to take a snapshot of a volume and only keep a certain number of these snapshots around. I wanted something that I could run from cron in different intervals for different volumes. I found a few scripts lying around, none of which I really liked so I decided to put together one in ruby.

I created the awstools gem, submitted a patch to amazon-ec2 to allow filter requests on the snapshot api and now I have the tool I was looking for.

Until my patch is accepted you’ll have to use my fork of the amazon-ec2 gem. Which means you’ll have to clone it to your machine, build the gem with “gem build amazon-ec2.gemspec” then install that gem with “gem install amazon-ec2…”.

To install awstools

gem install awstools

Or to build it yourself, clone the repo to your machine, and then run: