Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use AWS_REGION environment variable if it is set #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hartzell
Copy link

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

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.
@joelchen
Copy link

@rlmcpherson Please merge this pull request, thank you.

@sb10
Copy link

sb10 commented Mar 1, 2017

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
Copy link

Can confirm that this works great :)

@bnelz
Copy link

bnelz commented Jun 12, 2017

Another 👍 for this PR

@slawo
Copy link

slawo commented Oct 26, 2017

This would improve tings 👍

@aksel
Copy link

aksel commented Jan 26, 2023

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 😅 :

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants