Skip to content

Xiaowei/dependencies #27

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions datasets/utils/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,14 @@ def get_aws_session(role_arn: str = None, profile_name: str = None) -> Session:
role_arn=role_arn,
)

# Retrieve crednetials of the assumed role and auto-refresh
credentials = DeferredRefreshableCredentials(
method="assume-role", refresh_using=fetcher.fetch_credentials
# Create new session with assumed role and auto-refresh
botocore_session = Session()
botocore_session._credentials = DeferredRefreshableCredentials(
method="assume-role",
refresh_using=fetcher.fetch_credentials,
)

return boto3.Session(
aws_access_key_id=credentials.access_key,
aws_secret_access_key=credentials.secret_key,
aws_session_token=credentials.token,
region_name=region_name,
)
return boto3.Session(botocore_session=botocore_session, region_name=region_name)


def get_aws_client(role_arn: str, service: str):
Expand Down
Loading