Scheduling EC2 Backups with Skeddly (automated EBS snapshots)

A recent topic of conversation in the office has been backups. Three of us have experienced catastrophic hardware failures on our local development machines (i.e. our laptops). Thankfully, we are all obsessive about backups so we all got back up and running in no time. If you aren’t backing up your local system, then you need to read Sean’s excellent post on Selecting Cloud Backup Software. But what about your servers? And more specifically, what if you’re running an Amazon EC2 instance?

Like all things AWS, Amazon has many options for creating backups. If you setup your EC2 instance to use Elastic Block Storage (EBS), you can simply create a snapshot of your volume from the AWS Console. These EBS snapshots are incremental backups that persists on Amazon’s S3. Incremental means that only the blocks that have changed since your last snapshot are saved. This is all really slick, but manually creating snapshots from the AWS Console isn’t a good solution if your goal is to have daily, hourly, or whatever snaphots.

You could create your own service using command line tools. For example:

ec2-create-snapshot vol-id --description "Daily Backup"

Or, you could use Amazon’s API. For example:

https://ec2.amazonaws.com/ ?Action=CreateSnapshot &VolumeId=volume-id &AUTHPARAMS

The above options are really useful, but it takes a bit of time and fiddling to get everything right. The easiest solution I have found for scheduling automated snapshots is a service called Skeddly http://www.skeddly.com/.  Skeddly can do more than automate snapshots, but that’s what we’re going to look at in this post.

Using Skeddly

Sign Up and Create a Skeddly Specific AWS User

As of writing this post, you can get a 30-Day Trial of Skeddly, so go there now and sign up.

Before you sign up I would suggest creating an access key specifically for Skeddly. You do this by creating a user from the AWS Console under Identity and Access Manager (IAM). I created a user called skeddly with the following policy:

{ "Statement": [ { "Action": [ "ec2:CreateSnapshot", "ec2:DeleteSnapshot", "ec2:CreateTags", "ec2:DescribeInstances", "ec2:DescribeSnapshots", "ec2:DescribeTags" ], "Effect": "Allow", "Resource": "*" } ] }

If you need asstance creating a policy, you can use the AWS Policy Generator located at http://awspolicygen.s3.amazonaws.com/policygen.html

Add an Instance

After logging into Skeddly, select the Managed Instances tab and Add Instance. This is the easiest way to create your automated snapshots. You will need to know the following before you can fill out the form:

Instance ID: Get this from your AWS Console under EC2. You will see an instance column that displays your instance ids. Your instance id should look something like i-1a2b3c4d.

Elastic IP: If you want Skeddly to Stop/Start your instance to ensure the snapshot is complete you will need to supply the Elastic IP address associated with your instance. This is optional, but recommended.

Access Key: This is the IAM user I suggested creating above.

After supplying the necessary instance information you can jump down to Backup Instance and Delete Backups.

Create your schedule.

Note there are macros you can use to name your snapshot. I use something like

$(VOLUMENAME)$(DATE)

I keep a weeks worth of snapshots. And because my instance has three EBS volumes, I set the Minimum to Keep at 21. That’s 3 volumes x 7 days = 21.

Pricing

I think the pricing is incredibly reasonable. It costs $0.15 to create or delete a snapshot of each volume. That means I’m only spending $0.90/day to create three snapshots and delete three snapshots.

Scratching the Surface

Skeddly can do so much more. Once you get started, you may find yourself scheduling all sorts of tasks. Need to backup your RDS... Skeddly can do that. Create an AMI... let Skeddly handle it. Make a nice dinner... Skeddly can’t do that, but with all the time you’re saving why not put on your chef’s hat and prepare some grub.