Amazon Web Services multi-factor authentication on the command line#
You're a software developer working for a client who gave you an IAM user that requires multi-factor authentication.
All of your work for this client is in subdirectories of ~/client-foo
.
You'd like to run the aws
CLI, but you can't pass one-time tokens to it to authenticate.
wev
's contextual environment variables can manage that for you.
-
Install
wev
andwev-awsmfa
:pip3 install wev pip3 install wev-awsmfa
-
Create
~/client-foo/wev.yml
:[AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN]: plugin: id: wev-awsmfa
-
cd
into a project directory, then runaws
viawev
:cd ~/client-foo/project-bar wev aws s3 ls
-
You will be prompted to enter your one-time token, then
aws
will run.
Last update: 2021-01-23