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

Add support for resolving AWS region from ~/.aws/config #537

Open
jamesls opened this issue Jun 12, 2024 · 1 comment
Open

Add support for resolving AWS region from ~/.aws/config #537

jamesls opened this issue Jun 12, 2024 · 1 comment

Comments

@jamesls
Copy link

jamesls commented Jun 12, 2024

The AnthropicBedrock client resolves the AWS region using the AWS_REGION env var or defaulting to us-east-1:

if aws_region is None:
aws_region = os.environ.get("AWS_REGION") or "us-east-1"
self.aws_region = aws_region

However, there are additional ways to configure region (docs). In my case, I put all my configuration in ~/.aws/config and don't set any environment variables other than AWS_PROFILE so AnthropicBedrock was defaulting to us-east-1 instead of using my configured region.

You can get botocore to resolve the region using get_config_variable on the session instance:

>>> botocore.session.get_session().get_config_variable('region')
'us-west-2
@namanvats
Copy link

Fixed it here : #539, please review and merge

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

No branches or pull requests

2 participants