Skip to main content

An awscli plugin to authenticate and retrive AWS temporary credentials using a MFA device

Project description

AWS MFA Plugin

An awscli plugin to authenticate and retrive AWS temporary credentials using a MFA device.

Installation

This plugin was published in pypi.org. So the installation can be done using pip.

$ pip3 install --user aws-mfa-plugin

NOTE: We recommend installing inside user-site

Configure the plugin

If you are using awscli v1 configuring plugin is pretty simple.

$ aws configure set plugins.mfa aws-mfa

Otherwise, If you are using awscli v2, there is a need for additional config. see for more details.

$ aws configure set plugins.cli_legacy_plugin_path $(python3 -m site --user-site)

Assumed the plugin installed inside user-site

Verify plugin installation

If you configure correctly the plugin will become a subcommand of aws command.

$ aws mfa

Getting Started

Before using this plugin to retrieve temporary credentials you need to configure mfa_serial device.

$ aws configure set mfa_serial <your-mfa-serial-device>

To retrive temporary credentials

$ aws mfa cred-env
MFA Token for (arn:aws:iam::1234567890:mfa/username): 123456
export AWS_ACCESS_KEY_ID=<access-key-id>
export AWS_SECRET_ACCESS_KEY=<access-secret-key>
export AWS_SESSION_TOKEN=<token>

Or you can directly set these temporary credentials as environment variable by using eval command

$ eval $(aws mfa cred-env)
MFA Token for (arn:aws:iam::1234567890:mfa/username): 123456

License

This project licensed under MIT LICENSE, see LICENSE.

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-mfa-plugin-0.0.4.tar.gz (5.3 kB view hashes)

Uploaded Source

Built Distribution

aws_mfa_plugin-0.0.4-py3-none-any.whl (6.8 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