Kamal Nasser

Duplicity Amazon S3 backups

December 12 2012 post

I have just signed up for an Amazon Web Services account and set up S3, the process was quick and easy. I'm going to use it mainly for backups stored in Amazon S3. Amazon S3 is one of the simplest and safest places to keep backups. There is essentially an unlimited amount of storage, and it's pretty cheap.

This would be the first time I use S3 so I didn't quite know how it worked. With the aid of this blog post, I have set it up successfully. One problem I faced was a duplicity error:

Failed to create bucket (attempt #1) 'bucket name' failed (reason: S3ResponseError: S3ResponseError: 301 Moved Permanently

A quick Google search provided the solution. I had my bucket in the Ireland region as it is the nearest to my server, and Duplicity only supports US Standard by default. In the serverfault answer:

Duplicity also supports Amazon S3 URLs in this format: s3://host/bucket_name[/prefix] where host is the S3 endpoint for your region, which you can find in Amazon's list of endpoints.

For regions other than US Standard, you will want to have Duplicity use Amazon's "new style" subdomain bucket addressing, by adding --s3-use-new-style to your Duplicity command line.

After that I set up a cronjob to run every day at 00:00 (12:00 AM).

0 0 * * * /path/to/backup/script/from/the/blog/post