Using MFA with AWS CLI
MFA on AWS Cli
Description
Just writing down the steps ive been manually taken for updating my credentials to use ecr in aws from the cli.
- Check authy on phone and write down code
- Check arn from aws and write that down
- Issue this command
aws sts get-session-token --serial-number <arn here> --token-code <authy code>
- Take those values and plop the into
~/.aws/credentials
- Ensure the profile is
[mfa]
- Convert the json to the toml keys
- “SecretAccessKey”: aws_secret_access_key
- “SessionToken”: aws_session_token
- “AccessKeyId”: aws_access_key_id
- Issue the command
aws ecr get-login --profile mfa
- ecr above can be replaced with any service