s3gof3r icon indicating copy to clipboard operation
s3gof3r copied to clipboard

Use AWS_REGION environment variable if it is set

Open hartzell opened this issue 8 years ago • 6 comments

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

hartzell avatar Sep 16 '16 20:09 hartzell

@rlmcpherson Please merge this pull request, thank you.

joelchen avatar Dec 21 '16 11:12 joelchen

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.

sb10 avatar Mar 01 '17 09:03 sb10

Can confirm that this works great :)

josegonzalez avatar Mar 21 '17 01:03 josegonzalez

Another 👍 for this PR

bnelz avatar Jun 12 '17 21:06 bnelz

This would improve tings 👍

slawo avatar Oct 26 '17 09:10 slawo

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!

aksel avatar Jan 26 '23 13:01 aksel