wal-e/wal-e — pull request #3 by bshi (2013-02-01 01:19:14+00:00)
Title: Allow use of S3 buckets in regions other than us-east-1.

I ran across boto/443 and heroku/wal-e/24 this week. This patch attempts to work around boto/443 by making a call to detect a bucket's region. It's a bit hackish in that there are two places where S3 connections are established (S2Backup and boto.storage_uri). Tested lightly against a bucket ([a-z-]+) in Oregon.

The alternative to introspecting the region for a bucket would be to add an option/environment variable for the user to specify the exact AWS region to connect to. This particular portion of the AWS API isn't particularly well designed, however given that it's deterministic, I see no reason why the burden should be pushed to the end-user.

# Commit detail below

Work around region issue in S3Backup.new_connection and
boto.storage_uri. When attempting to connect to a bucket in a
non-standard (non us-east-1) region, boto complains

S3ResponseError: 301 Moved Permanently
The bucket you are attempting to access must be addressed using the
specified endpoint. Please send all future requests to this endpoint.

References:

https://github.com/boto/boto/issues/443
https://github.com/heroku/WAL-E/issues/24