Simple S3 Backups

Your Key to a Good Night's Sleep

We recently wrote some code to provide a simple way to backup our Rackspace server accounts to an Amazon S3 server. This method of backup gives us an additional offsite backup of all our hosted websites. We run this on our Rackspace servers, but it should work in any hosting environment.

As far as useage instructions go, there is a readme.txt file outlining the necessary parameters that need to be updated, but we will give an overview of the 4 main areas below.

1) MySQL database credentials

These are your basic username, password, host credentials that you would need to use to install any CMS.

2) Amazon S3 account credentials

These are your API and login credentials from your Amazon S3 account.

3) Path to directory that you want to backup

This is the location relative to the backup files directory that you want to backup. We put ours above the main website content directory and choose to backup the whole site, but you can choose any folder.

4) Frequency of backups and number of backups kept

We have our backups set to run daily for a week, weekly for a month, and monthly for 6 months. You can easily change that by setting the intervals in the set intervals section.

After you've set these parameters all you need to do is setup a cron job to execute the run_backup.php file every night. The script will automatically discard backups that are outside your interval parameters and feed them to your Amazon S3 server.

Hopefully this helps you sleep a little better at night knowing your data is fully protected offsite on a redundant CDN that is backed by Amazon's exceptional SLA.

If you have any questions or have feedback please feel free to contact us.

Download Zip File