bash script for aws cli authentication using an mfa token. source the script instead of just executing it so it preserves the newly set environment.
. ./aws-auth.sh {OPTIONS}
Example: . ./aws-auth -m arn:aws:iam::12345678:mfa/reuel -t TOKEN
OPTIONS:
-m arn of your virtual mfa device (stuff this in an environment variable for convenience)
-t token generated by your mfa device
you can use a command line token generator (e.g. YubiKey Manager CLI) and run:
. ./aws-auth.sh -m arn:aws:iam::12345678:mfa/reuel -t `ykman oath code -s amazon`
to configure your credentials file instead of setting enviroment variables, use the other script:
./aws-auth.sh2 -m arn:aws:iam::12345678:mfa/reuel -t `ykman oath code -s amazon`