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 account ID to the environment variable credential provider #3332

Open
wants to merge 2 commits into
base: account-id-endpoint-routing
Choose a base branch
from

Conversation

alexgromero
Copy link
Contributor

@alexgromero alexgromero commented Jan 8, 2025

Overview

This PR introduces account_id to the environment variable credential provider. With this update, users can now provide an AWS_ACCOUNT_ID environment variable, which will be associated with the credentials when they are loaded.

Testing

Functional testing to ensure the account_id gets propagated and resolved to the correct endpoint for each credential provider will be added in an upcoming PR.

@alexgromero alexgromero force-pushed the add-credentials-environment-provider branch from 4fd012d to 7295068 Compare January 8, 2025 22:45
@alexgromero alexgromero force-pushed the add-credentials-environment-provider branch from 7295068 to 0816d5d Compare January 8, 2025 22:49
botocore/credentials.py Outdated Show resolved Hide resolved
@@ -1127,8 +1129,12 @@ def __init__(self, environ=None, mapping=None):
:param mapping: An optional mapping of variable names to
environment variable names. Use this if you want to
change the mapping of access_key->AWS_ACCESS_KEY_ID, etc.
The dict can have up to 3 keys: ``access_key``, ``secret_key``,
``session_token``.
The dict can have up to 5 keys:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current mapping is:

{
    'access_key': 'AWS_ACCESS_KEY_ID',
    'secret_key': 'AWS_SECRET_ACCESS_KEY',
    'token': ['AWS_SECURITY_TOKEN', 'AWS_SESSION_TOKEN'],
    'expiry_time': 'AWS_CREDENTIAL_EXPIRATION',
    'account_id': 'AWS_ACCOUNT_ID',
}

@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2025

⚠️ 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 ✅

Please upload report for BASE (account-id-endpoint-routing@0effecf). Learn more about missing BASE report.

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

Additional details and impacted files
@@                      Coverage Diff                       @@
##             account-id-endpoint-routing    #3332   +/-   ##
==============================================================
  Coverage                               ?   93.18%           
==============================================================
  Files                                  ?       66           
  Lines                                  ?    14430           
  Branches                               ?        0           
==============================================================
  Hits                                   ?    13446           
  Misses                                 ?      984           
  Partials                               ?        0           

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

Co-authored-by: Nate Prewitt <nate.prewitt@gmail.com>
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.

3 participants