How to backup your Mac to an Amazon S3 server
April 20, 2009 by Sukrit Dhandhania
Very few of us really understand the value of backups until the day comes when we need to create that urgent report or we’re back from a fine holiday and something goes wrong with the computer and all your data is gone with it, reports, photographs, emails, music, all of it.
With the launch of MacOS X Leopard Apple has given Mac users Time Machine, which is arguably one of the coolest backup solutions out there. However, unless you’ve gone the distance and purchased the Time Capsule, you’re stuck using a regular USB or Firewire hard drive that you need to configure and remember to plug it in whenever you want to take a backup of your data. To overcome this problem I decided to take a look at online backup solutions. There are quite a few good solutions out there. However, I’ve settled for using Amazon’s S3 storage service. S3 is a really neat product from Amazon which gives users access to huge amounts of storage space over the Internet. It comes at a very small cost for every gigabyte of storage space. There’s a number of projects out there to help you backup your Mac to an S3 account. However, after doing some research I decided to settle for s3sync.
S3sync is a program written in Ruby which backs up your data to an S3 Bucket. An S3 Bucket is like a folder you create in your S3 account where you store your data. Although s3sync works across all platforms we’ll look at how to get it going on a Mac.
You will need the following information to be able to complete the backup process. You will need your S3 account’s Access Key ID and your Secret Access Key. You can get these by logging into your S3 account using your web browser. You also need to create a new S3 Bucket for your backups. You can create this from the S3 web interface.
To begin with download the latest version of s3sync. You can alternatively install s3sync using the following command:
# sudo gem install s3sync
Password:
Successfully installed s3sync-1.2.5
1 gem installed
Installing ri documentation for s3sync-1.2.5…
Installing RDoc documentation for s3sync-1.2.5…
You will prompted for your password. Go ahead and enter it. then hit the Return key to allow the s3sync to be installed. Next, enter your S3 account information into your bash profile by adding the following lines to the file .bash_profile in your user’s home directory.
export AWS_ACCESS_KEY_ID=”XXXX”
export AWS_SECRET_ACCESS_KEY=”XXXX”
(where XXXX is your access key and secret access key)
Now run the following command to create your first backup.
# s3sync -v -r –progress –delete ~/ my_backup_bucket:/
Now your data should be backed up to your Amazon S3 account. You should be able to see the progress of data transfer on your Terminal application’s window. Assuming all this worked fine for you and you are happy with the result you should consider making the backup process somewhat more efficient. You can enter this command shown above into a shell script. Call it something like s3backup.sh. Save the file in your user’s home directory and grant it executable privileges.
Now every time you want to run a backup just launch the Terminal application and run the following command:
# ./s3backup.sh
Now you can sleep peacefully at night knowing that some guy at Amazon’s data center is awake and keeping your data safe.
Edit from Ross: Mozy is a great backup solution if you’re not looking to backup ALL of your files, just important documents, bookmarks etc. Here’s a tutorial on using Mozy on a Mac. And Mozy gives out 2GB of storage/backup space for free to any user that signs up.



Comments
Feel free to leave a comment...
and oh, if you want a pic to show with your comment, go get a gravatar!