Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jhandguy/aws-mfa
Authenticate to AWS with MFA 🔐
https://github.com/jhandguy/aws-mfa
2fa aws mfa rust
Last synced: 24 days ago
JSON representation
Authenticate to AWS with MFA 🔐
- Host: GitHub
- URL: https://github.com/jhandguy/aws-mfa
- Owner: jhandguy
- License: mit
- Created: 2022-08-30T12:06:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-13T19:02:04.000Z (8 months ago)
- Last Synced: 2024-04-14T09:44:07.654Z (8 months ago)
- Topics: 2fa, aws, mfa, rust
- Language: Rust
- Homepage:
- Size: 326 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - jhandguy/aws-mfa - Authenticate to AWS with MFA 🔐 (Rust)
README
# aws-mfa
[![Version](https://img.shields.io/crates/v/aws-mfa)](https://crates.io/crates/aws-mfa)
[![Downloads](https://img.shields.io/crates/d/aws-mfa)](https://crates.io/crates/aws-mfa)
[![License](https://img.shields.io/crates/l/aws-mfa)](LICENSE)
[![Build](https://img.shields.io/github/actions/workflow/status/jhandguy/aws-mfa/ci.yaml)](https://github.com/jhandguy/aws-mfa/actions/workflows/ci.yaml)
[![Release](https://img.shields.io/github/actions/workflow/status/jhandguy/aws-mfa/cd.yaml?label=release)](https://github.com/jhandguy/aws-mfa/actions/workflows/cd.yaml)Authenticate to AWS with MFA 🔐
```shell
➜ aws-mfa
Authenticate to AWS with MFA 🔐Usage: aws-mfa
Commands:
file Authenticate to AWS with MFA using config and credentials files
env Authenticate to AWS with MFA using environment variables
help Print this message or the help of the given subcommand(s)Options:
-h, --help Print help
-V, --version Print version
```## Installation
**aws-mfa** is published on [crates.io](https://crates.io/crates/aws-mfa) and can be installed with
```shell
cargo install aws-mfa
```or via [homebrew-tap](https://github.com/jhandguy/homebrew-tap) with
```shell
brew install jhandguy/tap/aws-mfa
```or downloaded as binary from the [releases page](https://github.com/jhandguy/aws-mfa/releases).
## Usage
### Config and credentials files
Add default region in `~/.aws/config`:
```text
[profile -noauth]
region =[profile ]
region =
```Add basic credentials in `~/.aws/credentials`:
```text
[-noauth]
aws_access_key_id =
aws_secret_access_key =
```> **Note**: make sure to add the `-noauth` suffix to the profile name
Run the `aws-mfa file` command:
```shell
aws-mfa file -p -c
```Check generated credentials in `~/.aws/credentials`:
```shell
cat ~/.aws/credentials
```
```text
[]
aws_access_key_id =
aws_secret_access_key =
aws_session_token =
aws_session_expiration_timestamp =
```### Environment variables
Export default region and basic credentials as environment variables:
```shell
export AWS_REGION=
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
```Eval the `aws-mfa env` command:
```shell
eval $(aws-mfa env -c )
```Check exported environment variables:
```shell
env | grep AWS_
```
```text
AWS_REGION=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_SESSION_TOKEN=
AWS_SESSION_EXPIRATION_TIMESTAMP=
```