aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
2.95k stars 554 forks source link

JS SDK should try get region automatically from IMDS like other SDK languages do #6183

Open jedwards1211 opened 2 weeks ago

jedwards1211 commented 2 weeks ago

Describe the feature

Other versions of the SDK provide an option to get the region automatically when running on an EC2 instance or Lambda (for example the Java SDK)

There doesn't seem to be any good reason that the JavaScript SDK should behave differently.

Use Case

As the Java SDK's own documentation states:

When your code runs on Amazon EC2 or AWS Lambda, you might want to configure clients to use the same AWS Region that your code is running on. This decouples your code from the environment it’s running in and makes it easier to deploy your application to multiple AWS Regions for lower latency or redundancy.

Proposed Solution

Like the Java SDK, the JavaScript SDK region provider chain should try to get the region from IMDS if it's unable to get it from AWS_REGION or config files.

Other Information

No response

Acknowledgements

SDK version used

3.588

Environment details (OS name and version, etc.)

Amazon Linux 2023

aBurmeseDev commented 2 weeks ago

Hello again @jedwards1211 - appreciate you for your patience.

I'm doing internal investigation as far as which SDK languages support this "region fetching from IMDS" and will report back!