Impossible to create a bucket in us-east-1 if underlying botocore session sets another default region #3491
Replies: 3 comments 7 replies
-
As a workaround, we currently reset the config around the calls config = session._session.get_default_client_config()
config_no_region = config.merge(Config(region_name=None))
session._session.set_default_client_config(config_no_region)
try:
...
finally:
session._session.set_default_client_config(config) |
Beta Was this translation helpful? Give feedback.
-
Hi @ChristianWeymannTNG thanks for reaching out. A similar issue was raised here before: #125. The create-bucket documentation notes that regions outside of |
Beta Was this translation helpful? Give feedback.
-
I am aware of the behavior described in #125, this is different, apologies for not making that clear. Here, I am trying to create a bucket in I do not believe this is expected behavior. |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
When creating an S3 client with
region_name=us-east-1
from aboto3.Session
, if the underlyingbotocore.session.Session
is setup with abotocore.config.Config
that defines a differentregion_name
, creating buckets will always fail with anIllegalLocationConstraintException
Expected Behavior
Being able to create buckets in the
us-east-1
regionCurrent Behavior
Reproduction Steps
Possible Solution
In the example above, it seems like like for the specific case of "us-east-1", the S3 endpoint for "eu-west-1" is still called.
Additional Information/Context
No response
SDK version used
boto3 1.26.1, botocore 1.29.1
Environment details (OS name and version, etc.)
Tested on Ubuntu 20.04 and lambda runtime
python3.9
Beta Was this translation helpful? Give feedback.
All reactions