« Outsourcing Revisited And No One Is Safe | Home | Digg Style Pagination In Django Revisited »
Painless Amazon EC2 Backup
By Paul Kenjora | March 13, 2009
The past year on Amazon EC2 has taught me many things but first and foremost is back up consistently. I’ll say it again, back up consistently! Amazon even makes the backup almost painless, almost…
Amazon has EC2 (the compute cloud) and S3 (the data repository). Out of the box you can back up from EC2 to S3 using simple Amazon provided scripts like ec2-bundle-vol and ec2-upload-bundle. They both come already installed with the Linux images you start with.
I’ll inject some philosophy here. Some people believe that backing up the entire image is a waste of resources and you should instead back up only the data you need to S3. These people obviously have copious amounts of spare time on their hands. I’m not going to cry over the extra few MB, the benefit is being able to restore a backup in 30 automated seconds vs. twiddling with buckets and databases. Time is money.
The idea behind the code below is to backup entire images of a server on a rotating daily schedule. Rotation is set to create a unique manifest in your bucket per day of the week. If the system goes down or is compromised pick a backup day to restore, relaunch the instance from that image, and re-assign your Amazon IP address. The whole restore process should take no more than 30 seconds (Not counting instance boot).
To implement this backup strategy simply copy the following script into /root/backup.py and set up the following cron task (midnight backup):
crontab -e
0 0 * * * /root/backup.py
All codes above are fake but you should replace them with your own. Run the script manually or run it using the cron. Either way you get an automated painless Amazon EC2 backup.
More from Aware Labs
- Amazon EC2 Basics For The Curious
- Digg Style Pagination In Django Revisited
- Everything A Django Developer Needs To Create Logins
- When Django Apps Grow Up
- Authenticating Using Email vs Username
Aware Labs Recommends
- On Cloud 9 With Amazon EC2 (The Arkayne Blog)
- The day Twitter kicked CNN’s behind & @ev bought me a whisky (Robert Scoble Blog)
- What makes Arkayne Different? (The Arkayne Blog)
Topics: Batch Code, Environment Setup, Tutorial | Comments
-
HW
-
pkenjora
-
Mike Parsons
-
pkenjora
-
Nick
-
Rajesh D
-
Nick
-
Rajesh D
-
pkenjora
-
Rajesh D
-
Jonathan Fine
-
Odzyskiwanie Danych
-
danb
-
automated production
-
Press Controls
-
Conrad Decker
-
Conrad Decker
-
Dominic Watson
-
arpitjain
-
Ezra Klughaupt