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

[#353] leave region empty if none is provided #354

Closed
wants to merge 1 commit into from

Conversation

bbilger
Copy link

@bbilger bbilger commented Jan 9, 2024

...and as such leave the decision to the provider chain (e.g. env var AWS_REGION)

Issue #, if available:

cannot change region in any way

Description of changes:

if no region is provided then the decision will be made by the provider chain

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

...and as such leave the decision to the provider chain (e.g. env var AWS_REGION)
@stefanofornari
Copy link
Contributor

It looks good to me, but I may miss the background that lead to pick a default region. @markjschreiber ?

@markjschreiber
Copy link
Contributor

It looks good to me, but I may miss the background that lead to pick a default region. @markjschreiber ?

I believe S3 predates the concept of AWS regions which is why you get lots of quirks like bucket names are global but buckets have regions. This means that some SDK APIs that tell you the region of the bucket need to be directed to the us-east-1 endpoint. The sigv4 signature protocol requires a signature from a client configured for the same region that you are making a request to. So, if the bucket my-bucket lives in us-west-2 but you don't know that you won't be able to make requests to it until you figure out which region your client should be set to. Therefore we need a "region discovery client" that is always us-east-1 to do the region lookup. Once you find out that the region is us-west-2 then you need make a client with that region to make further requests to that bucket.

So, having us-east-1 as a default for null is a bug (except for region lookups) and null should fall back to the provider chain.

Another weird quirk is that the region lookup for a bucket in the us-east-1 region will return an empty string. This is possibly a legacy from when there was no regions and everything was us-east-1? The S3 API can probably not change this now as it would be a breaking change for legacy code.

@markjschreiber
Copy link
Contributor

Also resolved by PR #400

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.

3 participants