Read AWS credentials from disk (#14382) #14460
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Other programs can read the AWS key and secret from ~/.aws/credentials
(or other configuration file), and with this change Algo can as well.
Optional environment variables: AWS_PROFILE, AWS_SHARED_CREDENTIALS_FILE
The file is not read if the credentials are already set as an Ansible
variable or an environment variable.
Motivation and Context
Setting the credentials on the command line or as an environment variable is an unnecessary annoyance when the credentials are already configured in the official AWS way (like you would have after running
aws configure
). And the security implications are debatable, but if I already have the credentials in a config file, I don't want them in my shell history or my shell initialization.Issue here: #14382
How Has This Been Tested?
With AWS, I ran the main playbook:
I tested the following config file situations:
AWS_PROFILE
set)Errors that came up did not stop execution unless the authentication info was wrong. The "Deploy the template" task often failed during my testing, but this is an unrelated issue--the playbook can only get to that stage if the authentication info is okay.
I also added a test script that is more limited, but does some of the above checks.
Types of changes
Checklist: