This blog has moved to Medium

Subscribe via email

Posts tagged ‘python’

How to backup your EC2 instance using python

A while back, I asked on Server Fault how to backup an EC2 instance. I got a few good answers, but nothing that’s “batteries includes, copy-paste me and you’re done”.

As I recently started to learn Python (I’d like to get my hands dirty with OSQA code, and it aught to be useful in my upcoming job at Google), I turned to implement a simple backup script in Python.

I quickly found boto, an library for accessing EC2. They have a very helpful user group, and I wrote a small script that, will create a new Amazon AMI & snapshot, and take care to cleanup all AMIs and snapshots.

In the process of writing this, I found that boto itself has a very similar functionality included, but I was already well into writing my own wrapper script, and besides my scripts creates “ready to run” AMIs, and not just snapshots (lame excuse, but still).

So, to use, simply clone this github repository, make sure your python installation includes SSL, configure it and you should be good to go.