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

Default sts client config to regional endpoints #3309

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

bacoboy
Copy link

@bacoboy bacoboy commented Nov 22, 2024

Around 2022, AWS announced that all new SDKs would change the default STS endpoint behavior from the legacy endpoint to regional as documented here.

All new SDK major versions releasing after July 2022 will default to regional.
New SDK major versions might remove this setting and use regional behavior.
To reduce future impact regarding this change, we recommend you start using
regional in your application when possible.

This is used when clients call sts:AssumeRole. Using the legacy behavior, clients connect to sts.amazonaws.com, which lives in us-east-1. Workloads outside of that region using this configuration unknowingly depend on that region since they are not using the regional endpoint where their code runs.

botocore was never updated, so today, all calls to the STS API, unless otherwise explicitly configured, will use the "global" endpoint in us-east-1.

There was an outage in Aug 2024 which impacted STS in us-east-1.

Had botocore been updated, this specific event would not have impaired workloads running in other regions using a default client.

This PR attempts to align the new "default" to regional as specified by the documentation.

Should you require the old behavior, you can always set the environment variable to override the new default back to legacy (as documented):

export AWS_STS_REGIONAL_ENDPOINTS=legacy

A follow-up change to the documentation here will be needed to reflect this change.

Not a Python guru here, so I did my best at a first crack. Please review.

Thanks!

Around 2022, AWS announced that all new SDKs would change the default STS endpoint behavior from the `legacy` endpoint to `regional` as documented [here](https://docs.aws.amazon.com/sdkref/latest/guide/feature-sts-regionalized-endpoints.html).

> All new SDK major versions releasing after July 2022 will default to regional.
> New SDK major versions might remove this setting and use regional behavior.
> To reduce future impact regarding this change, we recommend you start using
> regional in your application when possible.

This is used when clients call `sts:AssumeRole`. Using the `legacy` behavior, clients connect to `sts.amazonaws.com,` which lives in `us-east-1.` Workloads outside of that region using this configuration unknowingly depend on that region since they are not using the `regional` endpoint where their code runs.

botocore was never updated, so today, all calls to the STS API, unless otherwise explicitly configured, will use the "global" endpoint in `us-east-1.`

There was an [outage in Aug 2024](https://health.aws.amazon.com/health/status?eventID=arn:aws:health:global::event/IAM/AWS_IAM_OPERATIONAL_ISSUE/AWS_IAM_OPERATIONAL_ISSUE_C9750_3CF4B9D9C39)
which impacted STS in `us-east-1`.

Had botocore been updated, this specific event would not have impaired workloads running in other regions using a default client.

This PR attempts to align the new "default" to `regional` as specified by the documentation.

Should you require the old behavior, you can always set the environment variable to override the new default back to `legacy` (as documented):

```
export AWS_STS_REGIONAL_ENDPOINTS=legacy
```

A follow-up change to the documentation [here](https://github.com/boto/boto3/blob/f46cfc9eee4c5f3961ad53475d1623d7f01b6bef/docs/source/guide/configuration.rst?plain=1#L415) will be needed to reflect this change.

Not a Python guru here, so I did my best at a first crack.  Please review.

Thanks!
@codecov-commenter
Copy link

codecov-commenter commented Nov 26, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.19%. Comparing base (0af86dc) to head (a0425b1).
Report is 86 commits behind head on develop.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3309   +/-   ##
========================================
  Coverage    93.19%   93.19%           
========================================
  Files           66       66           
  Lines        14376    14377    +1     
========================================
+ Hits         13397    13398    +1     
  Misses         979      979           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

2 participants