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

Customize boto3/botocore client instances to use the AWS CLI credential cache #1534

Closed
hannes-ucsc opened this issue Feb 3, 2020 · 1 comment
Assignees
Labels
demoed [process] Successfully demonstrated to team orange [process] Done by the Azul team

Comments

@hannes-ucsc
Copy link
Member

hannes-ucsc commented Feb 3, 2020

The code added in 4b1c051 and further improved in 0c91f99 works when the python interpreter is invoked from the same shell that _preauth was invoked from, but not when running/debugging code from within PyCharm (unless PyCharm was launched from a shell that already ran _preauth).

One solution would be to consolidate boto3 client instantiation in a central place and configure the client to use the AWS CLI credential cache just like _preauth function does. Care must be taken to not break, slow down or interfere with client allocation in other contexts, like Travis, Gitlab or AWS lambda.

Also see this PR for an previous effort to consolidate the client instantiation.

@github-actions github-actions bot added the orange [process] Done by the Azul team label Feb 3, 2020
@jessebrennan
Copy link
Contributor

A potential solution is to initialize boto3's botocore session to use a session that links to the CLI cache. This initialization should happen within envhook.py script so that it affects every Python process.

hannes-ucsc pushed a commit that referenced this issue Feb 8, 2020
This ensures that you only have to reenter you MFA key when it
expires instead of once per session.
@jessebrennan jessebrennan added the demoed [process] Successfully demonstrated to team label Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
demoed [process] Successfully demonstrated to team orange [process] Done by the Azul team
Projects
None yet
Development

No branches or pull requests

2 participants