rlmcpherson / s3gof3r

Fast, concurrent, streaming access to Amazon S3, including gof3r, a CLI. http://godoc.org/github.com/rlmcpherson/s3gof3r
MIT License
1.15k stars 181 forks source link

Use AWS_REGION environment variable if it is set #109

Open hartzell opened 8 years ago

hartzell commented 8 years ago

Use AWS_REGION environment variable if it is set.

Without this change, trying to put to a bucket in a region other than us-east-1 results in something like:

gof3r error: 400: "The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'us-west-2'"

I only have buckets in us-west-2, and I have verified that this change (and export AWS_REGION=us-west-2) allows me to put, cp, and get objects from those buckets.

I am not sure how it interacts with some of the other features.

This may solve #90

joelchen commented 7 years ago

@rlmcpherson Please merge this pull request, thank you.

sb10 commented 7 years ago

Would be great if this was accepted. I had to independently come up with this fix to get it to work with a radosgw S3-compatible ceph object gateway.

josegonzalez commented 7 years ago

Can confirm that this works great :)

bnelz commented 7 years ago

Another 👍 for this PR

slawo commented 7 years ago

This would improve tings 👍

aksel commented 1 year ago

It's possible to work around this, by using a regional endpoint, found here: https://docs.aws.amazon.com/general/latest/gr/s3.html

EDIT: This seems to break my credentials, tho, so now I'm a bit lost :sweat_smile: :

EDIT 2: Nevermind, turns out it's because this uses env var AWS_SECURITY_TOKEN, whereas the AWS CLI uses AWS_SESSION_TOKEN. Setting AWS_SECURITY_TOKEN=$AWS_SESSION_TOKEN fixes it for me. Hooray!