Backing up Apache and MySQL to Amazon S3

imageBackups, you know they are important right? I have written before about backing up my PC, but over time I have accumulated a bunch of data in web sites and MySql databases.  Starting with my blog, as well as Thinkup and Tweetnest, and an installation of YOURLS, and a few other miscellaneous PHP files, and databases, I have a lot of backups to worry about.  Sure my host Dreamhost maintains backups (which I have used), but Dreamhost recommends and common sense dictates that I have some kind of backup plan of my own.

I have used a number of different methods over time, including WordPress plugins, xcloner, and others but nothing was quite as simple and complete as I was looking for.

Finally over the last couple of weeks I found something that meets all my criteria, automatic, includes files and databases, and backs up to another site (i.e not on a Dreamhost server).

The destination for my backups is Amazon S3, cheap (no really cheap) reliable storage accessible from anywhere. Next I found S3 Tools, command line tools for Linux to interact with S3.  I simply copied the files up to my server, ran s3cmd –configure, plugged in my access and secret key, S3 bucket name and I was connected to S3.

I was going to write my own scripts to dump MySQL data and tar up some directories, but happily I found someone had already done that, with a few simple modifications to that script, and a quick cron job I had my backups up and running in not time.

There are still a few tweaks I would like to make to this process, but for now I finally have my backups running the way I like them.

One Response to Backing up Apache and MySQL to Amazon S3
  1. David Goldstein
    December 29, 2011 | 4:57 pm

    Can you elaborate on how you use the backup script? I’m having trouble customizing it to seperate apps. (My poor shell scripting skills are probably to blame.)