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
Boto3 isnt fetching region from IMDS #375
Comments
This is a doc bug. We only use IMDS for credentials, not for configuration. #376 corrects the docs. |
shouldn't it also use the IMDS for region if none is provided? If I'm running some boto code on an EC2 instance, and have not provided a region through any other mechanism (env, arg to the connection method, etc), then I probably want that code to connect to the local region. |
This was also requested for the AWS CLI: aws/aws-cli#486 I think the main hesitation was that this could be unexpected for users. If you have a script you've developed that worked in us-west-2 (relying on this behavior) and you copy it over to a us-east-1 instance, it could be hard to troubleshoot why the script wasn't working, especially if this feature is on by default. A user may not be aware they're relying on this functionality. That being said, we'd still like more feedback on this. I assume you'd find this functionality useful? |
AWS's Java SDK resolves region via instance metadata, if there is no environment variable, system property, or ~.aws/config value saying otherwise. Its too bad the different SDKs follow different preferences for doing the same thing. It is very nice that all the SDKs now resolve credentials the exact same way (see https://aws.amazon.com/blogs/security/a-new-and-standardized-way-to-manage-credentials-in-the-aws-sdks/), too bad region resolution has to be inconsistent. |
any dynamic way to get the current region of the EC2 instance other than a |
According to the docs (https://boto3.readthedocs.org/en/latest/guide/configuration.html), boto3 should be fetching the region from the instance metadata service if it's running on an EC2 instance. This does not appear to be the case.
Steps to reproduce:
The text was updated successfully, but these errors were encountered: