https://github.com/ahmadnurus/aws-mfa-plugin
An awscli plugin to authenticate and retrive AWS temporary credentials using a MFA device
https://github.com/ahmadnurus/aws-mfa-plugin
aws aws-cli aws-cli-plugin
Last synced: 17 days ago
JSON representation
An awscli plugin to authenticate and retrive AWS temporary credentials using a MFA device
- Host: GitHub
- URL: https://github.com/ahmadnurus/aws-mfa-plugin
- Owner: ahmadnurus
- License: mit
- Created: 2021-07-08T14:46:42.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-07-08T17:34:56.000Z (about 5 years ago)
- Last Synced: 2026-02-07T16:59:53.352Z (5 months ago)
- Topics: aws, aws-cli, aws-cli-plugin
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://pypi.org/project/aws-mfa-plugin/). So the installation can be done using pip.
```shell
$ 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.
```shell
$ aws configure set plugins.mfa aws-mfa
```
Otherwise, If you are using awscli v2, there is a need for additional config. [see](https://docs.aws.amazon.com/cli/latest/userguide/cliv2-migration.html#cliv2-migration-profile-plugins) for more details.
```shell
$ 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.
```shell
$ aws mfa
```
## Getting Started
Before using this plugin to retrieve temporary credentials you need to configure mfa_serial device.
```shell
$ aws configure set mfa_serial
```
To retrive temporary credentials
```shell
$ aws mfa cred-env
MFA Token for (arn:aws:iam::1234567890:mfa/username): 123456
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
export AWS_SESSION_TOKEN=
```
Or you can directly set these temporary credentials as environment variable by using `eval` command
```shell
$ eval $(aws mfa cred-env)
MFA Token for (arn:aws:iam::1234567890:mfa/username): 123456
```
## License
This project licensed under MIT LICENSE, see [LICENSE](https://github.com/prksu/aws-mfa-plugin/blob/main/LICENSE).