-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Read AWS credentials from disk (#14382) #14460
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
Conversation
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.
We could use https://github.com/99designs/aws-vault instead of files |
I do not use ~/.aws/credentials for security reason. I like ansible vault. I think it is already installed with the ansible requirements of Algo, or it is a small extra step
e.g. aws-secrets.vault.yml aws_access_key: ...
aws_secret_key: ... The command
|
Thank you for this contribution! This is a valuable feature that aligns with standard AWS practices. After reviewing the implementation, we've identified several improvements needed:
Rather than requesting multiple changes on this PR, we'll create a new PR that incorporates your work along with these fixes. We'll make sure to credit you for the original implementation. Closing this in favor of the upcoming PR. Thank you again for identifying this need and providing the initial implementation! |
- Automatically reads AWS credentials from ~/.aws/credentials - Supports AWS_PROFILE and AWS_SHARED_CREDENTIALS_FILE environment variables - Adds support for temporary credentials with session tokens - Maintains backward compatibility with existing credential methods - Follows standard AWS credential precedence order Based on PR #14460 by @lefth with the following improvements: - Fixed variable naming to match existing code (access_key vs aws_access_key) - Added session token support for temporary credentials - Integrated credential discovery directly into prompts.yml - Added comprehensive tests - Added documentation Closes #14382
- Automatically reads AWS credentials from ~/.aws/credentials - Supports AWS_PROFILE and AWS_SHARED_CREDENTIALS_FILE environment variables - Adds support for temporary credentials with session tokens - Maintains backward compatibility with existing credential methods - Follows standard AWS credential precedence order Based on PR #14460 by @lefth with the following improvements: - Fixed variable naming to match existing code (access_key vs aws_access_key) - Added session token support for temporary credentials - Integrated credential discovery directly into prompts.yml - Added comprehensive tests - Added documentation Closes #14382
* feat: Add AWS credentials file support - Automatically reads AWS credentials from ~/.aws/credentials - Supports AWS_PROFILE and AWS_SHARED_CREDENTIALS_FILE environment variables - Adds support for temporary credentials with session tokens - Maintains backward compatibility with existing credential methods - Follows standard AWS credential precedence order Based on PR #14460 by @lefth with the following improvements: - Fixed variable naming to match existing code (access_key vs aws_access_key) - Added session token support for temporary credentials - Integrated credential discovery directly into prompts.yml - Added comprehensive tests - Added documentation Closes #14382 * fix ansible lint --------- Co-authored-by: Jack Ivanov <17044561+jackivanov@users.noreply.github.com>
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: