Skip to main content

It can help you to access AWS resources through AWS CLI with MFA token

Project description

AWS CLI MFA

It can help you to access AWS resources through AWS CLI with MFA token.

Preperation

  1. AWS CLI environemnt (including configurations in ~/.aws)
$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
$ unzip awscliv2.zip
$ sudo ./aws/install
  1. AWS profile name should follow this rule. You need to prepare 2 profiles. One for your original IAM user ${profile}-default, and ther other is for your temporary profile, activated by MFA token. ${profile}.
# Let's assume your IAM user name is 'lol'
# ~/.aws/credentials
[lol-default]
aws_access_key_id = ...
aws_secret_access_key = ...

[lol]

Usage

argument description mandatory default
--mfa MFA token code (--token-code) Y -
--profile AWS profile you want to use (--profile) N AWS_PROFILE in your shell
--arn ARN of the MFA device (--serial-number) N .credentials' mfa_device_arn
# Your profile should be 'lol'
$ echo $AWS_PROFILE
  lol

# 1st usage: pass arn of mfa togegher
# then, credentials keep your temporary information.
$ aws-cli-mfa --mfa ${mfa-token} --arn arn:aws:iam::${account-id}:mfa/${username} 

# Further usage: only pass mfa token is enough
$ aws-cli-mfa --mfa ${mfa-token}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws-cli-mfa-0.1.1b0.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

aws_cli_mfa-0.1.1b0-py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page