A tool to quickly get and set your MFA token, to make using the CLI easier.
Clone this repository, open a terminal and run:
./AWS-CLI-MFA.py 000000
where 000000 is the token generated by yout MFA device.
usage: AWS-CLI-MFA.py [-h] [--profile PROFILE] [--arn ARN]
[--credential-path CREDENTIAL_PATH]
[--duration DURATION]
token
Update your AWS CLI Token
positional arguments:
token token from your MFA device
optional arguments:
-h, --help show this help message and exit
--profile PROFILE AWS profile to store the session token. If unset,
ENV(AWS_PROFILE) or first profile in "~/.aws/config"
will be used.
--arn ARN AWS ARN from the IAM console (Security credentials ->
Assigned MFA device). This is saved to your
.aws/credentials file
--credential-path CREDENTIAL_PATH
path to the aws credentials file
--duration DURATION The duration, in seconds, that the credentials should
remain valid.
If you do not want to input your MFA device's arn, you can configure it in ./aws/config
[default]
(...)
mfa_serial = arn:aws:iam::123456789123:mfa/my_iam_user