Giter Club home page Giter Club logo

awsmfa's Introduction

awsmfa (AWS MFA Refresher)

Test Status Apache-2.0 license

awsmfa replaces the config and credentials for MFA in AWS.

Usage

$ awsmfa [options] [token-code]
  • The config file uses ~/.aws/config by default. You can override it with the environment variable AWS_CONFIG_FILE.
  • The credentials file uses ~/.aws/credentials by default. You can override it with the environment variable AWS_SHARED_CREDENTIALS_FILE.

Options

--profile string
	The name of the profile from which the session can be obtained (default `default`)

--mfa-profile-name string
	MFA profile name (default `mfa`)

--duration-seconds int64
	Session expiration duration secounds (default `43200`)

--serial-number string
	AWS serial number. `--serial-number` is required

--quiet bool
	if enabled, log is not printed in the console. (default `false`)

Example

$ awsmfa --serial-number arn:aws:iam::123456789012:mfa/future-architect --profile my-profile 123456
2021/02/28 11:01:49 Wrote session token for profile mfa, expiration: 2021-02-28 14:01:49.689 +0000 UTC

initial

  • .aws/config
BeforeAfter
[default]
region = us-east-1
output = json
[default]
region = us-east-1
output = json

[profile mfa]
  • .aws/credentials
BeforeAfter
[default]
aws_access_key_id = ABCDEFGHIJKLMNOPQRST
aws_secret_access_key = ChcdJbC9kraRNW5iy8XgDyR4QNRT44kKRPmKEGQT
[default]
aws_access_key_id     = ABCDEFGHIJKLMNOPQRST
aws_secret_access_key = ChcdJbC9kraRNW5iy8XgDyR4QNRT44kKRPmKEGQT

[mfa]
aws_access_key_id     = AKIAIOSFODNN7EXAMPLE
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY
aws_session_token     = AQoEXAMPLEH4aoA....

next time

Update aws_access_key_id, aws_secret_access_key and aws_session_token in the target section (default is mfa) of .aws/credentials.

Installation

  • From binary
# Install the latest version. (Install it into ./bin/ by default).
$ curl -sfL https://raw.githubusercontent.com/future-architect/awsmfa/master/install.sh | sh -s

# Specify installation directory ($(go env GOPATH)/bin/) and version.
$ curl -sfL https://raw.githubusercontent.com/future-architect/awsmfa/master/install.sh | sh -s -- -b $(go env GOPATH)/bin [vX.Y.Z]

On Windows, you can run the above commands with Git Bash, which comes with Git for Windows.

  • From source code
$ go install github.com/future-architect/awsmfa/cmd/awsmfa@latest

awsmfa's People

Contributors

d-tsuji avatar johejo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.