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

Cannot use credentials in memory; only awscli credentials #2

Open
fstab50 opened this issue Nov 25, 2019 · 0 comments
Open

Cannot use credentials in memory; only awscli credentials #2

fstab50 opened this issue Nov 25, 2019 · 0 comments

Comments

@fstab50
Copy link
Owner

fstab50 commented Nov 25, 2019

When access key and secret key are exported to the shell environment (as env vars), boto3 will use them first before looking for credentials submitted via the awscli and --profile <value>.

spotlib currently fails authentication to AWS if credentials are environment variables. A pre-run test module must be developed that performs an authentication test to find out if the environment contains valid credentials. If yes, use them, if no keys in the environment, spotlib must then utilise awscli credentials.

The following code could be utilised as a pre-run test and branch on the results, performing the run.

try:
    client = boto3.client('sts')
    client.get_caller_identity()
except Exception:
    print('try --profile')

Credential hierarchy for spotlib matches boto3:

  • use in memory credentials if found & valid
  • else use awscli credentials
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

No branches or pull requests

1 participant