#aws #mfa #2fa

bin+lib aws-mfa

Authenticate to AWS with MFA 🔐

33 releases

0.2.16 Mar 6, 2023
0.2.13 Jan 28, 2023
0.2.10 Dec 22, 2022
0.2.7 Nov 29, 2022

#1074 in Command line utilities

Download history 89/week @ 2022-12-03 27/week @ 2022-12-10 95/week @ 2022-12-17 31/week @ 2022-12-24 19/week @ 2022-12-31 20/week @ 2023-01-07 45/week @ 2023-01-14 52/week @ 2023-01-21 57/week @ 2023-01-28 95/week @ 2023-02-04 71/week @ 2023-02-11 128/week @ 2023-02-18 12/week @ 2023-02-25 34/week @ 2023-03-04 5/week @ 2023-03-11 70/week @ 2023-03-18

124 downloads per month
Used in aoss-curl

MIT license

18KB
226 lines

aws-mfa

Version Downloads License Build Release

Authenticate to AWS with MFA 🔐

 aws-mfa -h
Authenticate to AWS with MFA 🔐

Usage: aws-mfa [OPTIONS] --code <CODE> <HOME>

Arguments:
  <HOME>  Home directory containing the AWS hidden folder [env: HOME=/Users/JohnDoe]

Options:
  -r, --region <REGION>      Name of the AWS region [default: eu-west-1]
  -p, --profile <PROFILE>    Name of the AWS profile [default: default]
  -s, --suffix <SUFFIX>      Suffix of the original AWS profile [default: noauth]
  -c, --code <CODE>          MFA code
  -d, --duration <DURATION>  Session duration in seconds [default: 3600]
  -h, --help                 Print help
  -V, --version              Print version

Installation

aws-mfa is published on crates.io and can be installed with

cargo install aws-mfa

or via homebrew-tap with

brew install jhandguy/tap/aws-mfa

or downloaded as binary from the releases page.

Usage

Add basic credentials in ~/.aws/credentials:

[<profile_name>-noauth]
aws_access_key_id = <aws_access_key_id>
aws_secret_access_key = <aws_secret_access_key>

Note: make sure to add the -noauth suffix to the profile name

Run aws-mfa:

aws-mfa -p <profile_name> -c <mfa_code>

Check generated credentials in ~/.aws/credentials:

[<profile_name>]
aws_access_key_id = <aws_access_key_id>
aws_secret_access_key = <aws_secret_access_key>
aws_session_token = <aws_session_token>

Dependencies

~16–23MB
~490K SLoC