aws-mfa-session

Crates.ioaws-mfa-session
lib.rsaws-mfa-session
version0.2.4
sourcesrc
created_at2020-04-18 11:34:49.894198
updated_at2020-08-04 20:49:54.376313
descriptionA command line utility to generate temporary AWS credentials with virtual MFA device. Credentials could be exported into new shell or inserted into aws credentials file.
homepagehttps://github.com/AnderEnder/aws-mfa-session
repositoryhttps://github.com/AnderEnder/aws-mfa-session
max_upload_size
id231483
size72,469
Andrii Radyk (AnderEnder)

documentation

https://github.com/AnderEnder/aws-mfa-session

README

aws-mfa-session

build status codecov crates.io

A command line utility to generate temporary AWS credentials with virtual MFA device. Credentials could be exported into new shell or inserted into aws credentials file.

Features

  • support only virtual MFA devices (current limitation of API)
  • select any profile from credential file
  • detect MFA device from user profile
  • generate temporary credentials (using sts)
  • update profile in the credential file with generated credentials

Release page distributions

Github Release page provides binaries for:

  • Windows
  • Linux
  • macOS

Examples

Generate session credentials with default profile, and print the credentials as exported environment variables

aws-mfa-session --code 123456 -e

Could be used to inject variables into the current shell

eval $(aws-mfa-session -c 464899 -e)

Generate session credentials with default profile and MFA arn:

aws-mfa-session --arn arn:aws:iam::012345678910:mfa/username --code 123456 -e

Generate session credentials with default profile and non-default region:

aws-mfa-session --region us-east2 --code 123456 -e

Generate session credentials with default profile, and run a new shell with new shell with exported environment variables

aws-mfa-session --code 123456 -s

Generate session credentials with default profile, and create or update a new profile:

aws-mfa-session --update-profile mfa-session --code 123456

Generate session credentials with defined profile, and create or update a new profile:

aws-mfa-session --profile dev --update-profile mfa-session --code 123456

Generate session credentials with defined profile and non-default credential file, and create or update a new profile:

aws-mfa-session --credentials-file .aws/credentials2 --profile dev --update-profile mfa-session --code 123456

How to build and install

Requirements: rust and cargo

# Build
cargo build --release

# Install from local source
cargo install

# Install latest from git
cargo install --git https://github.com/AnderEnder/aws-mfa-session

# Install from crate package
cargo install aws-mfa-session
Commit count: 102

cargo fmt