-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix(NODE-5551): set AWS region from environment variable for STSClient #3831
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nbbeeken
force-pushed
the
NODE-5551-aws-sts-region
branch
from
August 21, 2023 18:06
4142463
to
26f6e5f
Compare
nbbeeken
force-pushed
the
NODE-5551-aws-sts-region
branch
from
August 21, 2023 18:27
26f6e5f
to
c6397ee
Compare
nbbeeken
commented
Aug 21, 2023
Looking at the tests on this task: aws-6.0-auth-test-run-aws-auth-test-AssumeRoleWithWebIdentity-with-AWS_ROLE_SESSION_NAME-set |
nbbeeken
changed the title
fix(NODE-5477): set AWS region from environment variable for STSClient
fix(NODE-5551): set AWS region from environment variable for STSClient
Aug 21, 2023
nbbeeken
commented
Aug 21, 2023
W-A-James
added
the
Primary Review
In Review with primary reviewer, not yet ready for team's eyes
label
Aug 22, 2023
W-A-James
reviewed
Aug 22, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from the one question on the test file (which I won't block on), LGTM
W-A-James
added
Team Review
Needs review from team
and removed
Primary Review
In Review with primary reviewer, not yet ready for team's eyes
labels
Aug 22, 2023
durran
requested changes
Aug 24, 2023
W-A-James
approved these changes
Aug 28, 2023
5 tasks
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
What is changing?
AWS_STS_REGIONAL_ENDPOINTS
andAWS_REGION
environment variables and setting the correspondingfromNodeProviderChain
options.LEGACY_REGIONS
is created from this: https://docs.aws.amazon.com/sdkref/latest/guide/feature-sts-regionalized-endpoints.html documentationAWS_STS_REGIONAL_ENDPOINTS
.Is there new documentation needed for these changes?
Yes. Will file a docs ticket.
What is the motivation for this change?
AWS recommends setting your STS region to be as close to your app as possible to reduce latency but currently, the JS SDK does not use the common AWS region environment variables, and the setting must be controlled programmatically.
Tracking issue here: aws/aws-sdk-js-v3#5105
Release Highlight
Use region settings for STS AWS credentials request
When using IAM AssumeRoleWithWebIdentity AWS authentication the driver uses the @aws-sdk/credential-providers package to contact the Security Token Service API for temporary credentials. AWS recommends using Regional AWS STS endpoints instead of the global endpoint to reduce latency, build-in redundancy, and increase session token validity. Unfortunately, environment variables
AWS_STS_REGIONAL_ENDPOINTS
andAWS_REGION
do not directly control the region the SDK's STS client contacts for credentials.The driver now has added support for detecting these variables and setting the appropriate options when calling the SDK's API: fromNodeProviderChain().
Important
The driver will only set region options if BOTH environment variables are present.
AWS_STS_REGIONAL_ENDPOINTS
MUST be set to either'legacy'
or'regional'
, andAWS_REGION
must be set.Double check the following
npm run check:lint
scripttype(NODE-xxxx)[!]: description
feat(NODE-1234)!: rewriting everything in coffeescript