simples3 icon indicating copy to clipboard operation
simples3 copied to clipboard

Add support for buckets in different regions

Open tyilo opened this issue 12 years ago • 9 comments

When trying to use simples3 to connect to a bucket hosted in eu-west-1, I get the following error:

The bucket you are attempting to access must be addressed using the specified endpoint.

tyilo avatar Sep 04 '13 21:09 tyilo

+1

heynairb avatar Nov 13 '14 17:11 heynairb

does this fixed or not?

Wakeupbuddy avatar Mar 01 '15 17:03 Wakeupbuddy

same issue here. this should be top prio.

jjacarillo avatar Mar 02 '15 22:03 jjacarillo

Tell me how you are trying to connect to it, I used simples3 with European servers many times!

lericson avatar Mar 03 '15 09:03 lericson

bucket = simples3.S3Bucket(name="mybucket", base_url="http://eu-west.whatever.com/")

I forget exactly how the incantation looks. I'm all for adding a simples3.connect though, or open. Suggestions?

lericson avatar Mar 03 '15 09:03 lericson

@lericson yes, I had to provide the full url (not just the base) into base_url for it to work. but it does not look so natural. but this looks pretty:

bucket = S3Bucket(name='mybucket', region='us-west1')

jjacarillo avatar Mar 04 '15 19:03 jjacarillo

Alright, that sounds awesome. Could you perhaps post some example of how to use a different region, so it can be included in the documentation until we get a better API?

lericson avatar Mar 27 '15 12:03 lericson

I found a solution:

bucket = 'my_bucket'
access_key = 'AAAAAAAAAAAAAAAAAA'
secret_key = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'

s = simples3.S3Bucket(bucket,
    base_url="http://s3-eu-west-1.amazonaws.com/%s" % bucket,
    access_key=access_key,
    secret_key=secret_key)

s.put( 'todel.txt', 'blabla' )

mdauphin avatar Feb 01 '16 09:02 mdauphin

Good stuff, would do well to make a more obvious API though.

  • Ludvig

On 1 feb. 2016, at 10:44, mdauphin [email protected] wrote:

I found a solution:

bucket = 'my_bucket' access_key = 'AAAAAAAAAAAAAAAAAA' secret_key = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'

s = simples3.S3Bucket(bucket, base_url="http://s3-eu-west-1.amazonaws.com/%s" % bucket, access_key=access_key, secret_key=secret_key)

s.put( 'todel.txt', 'blabla' ) — Reply to this email directly or view it on GitHub.

lericson avatar Feb 01 '16 12:02 lericson