-
Notifications
You must be signed in to change notification settings - Fork 6
How It Works
David Nguyen edited this page Nov 12, 2020
·
1 revision
- The
get
andset
commands work primarily on AWSconfig
andcredentials
files. -
set
command setsdefault
profile in eitherconfig
orcredentials
file with values (e.g.aws_access_key_id
andaws_secret_access_key
orrole_arn
andsource_profile
) from selected profile. -
get
command first checks whether AWS credentials environment variables (e.g.AWS_ACCESS_KEY_ID
,AWS_SESSION_TOKEN
) are set. If yes, it will do a call to STS to get caller identity and cache the result locally. If those environment variables are not set, it compares values ofdefault
profile with other profiles inconfig
andcredentials
files and returns the matched profile -
export
command prints out suitable command for your OS (export
in Linux/MacOS or$env:VAR
setting in Windows Powershell). These printed commands can be copied and executed directly in your terminal to set suitable AWS environment variables (AWS_ACCESS_KEY_ID
,AWS_SECRET_ACCESS_KEY
,AWS_SESSION
). The purpose of this command is to support some of the tools that don't work well with AWSconfig
andcredentials
files, e.g.- Terraform aws provider with role that requires MFA https://github.com/terraform-providers/terraform-provider-aws/issues/2420
- Or when you want to execute AWS CLI commands inside a container and it's not convenient to mount host machine
~/.aws
folder