Code Monkey home page Code Monkey logo

aws-cli-mfa's Introduction

aws-cli-mfa

This package provides a utility to make using multi-factor authentication easier with the aws-cli.

Prerequisites

This package depends on aws-cli and jq.

Compatibility

This should be compatible with phone authenticator apps as well as physical security keys. It has been tested with Google Authenticator and a Yubikey 5C.

Installation

MacOS: Install using homebrew

$ brew tap razrmarketing/aws-cli-mfa [email protected]:razrmarketing/aws-cli-mfa.git
$ brew install aws-cli-mfa

Manual installation: Install the prerequisites, place the aws-mfa.sh script somewhere in your PATH and mark it as executable.

Before Use

Before you can use this tool you must configure your aws-cli with a default profile. You can simply follow the AWS Quick configuration guide.

Usage

Simply run the aws-mfa command. It will pull the first MFA device on your user profile and ask for an MFA code. Provide the code from your authenticator app, or touch/press the button on your security key.

$ aws-mfa
Using MFA device: arn:aws:iam::111111111111:mfa/username
Enter MFA code: ******
Getting session token
Configuring credentials for profile mfa

Done.

Ths first time, this will create a new AWS profile in your ~/.aws/credentials file named mfa. When your session expires (12 hours by default) you can run the command again and the profile will be updated.

Options

aws-mfa
[--duration-seconds <value>]
[--serial-number <value>]
[--profile <value>]

--duration-seconds (integer)

The duration, in seconds, your session lasts. See AWS Documentation.

--serial-number (string)

The MFA device serial number or ARN. See AWS Documentation.

--profile (string)

The name of the AWS profile you want to use. Defaults to mfa.

Usage with multiple profiles

If you have multiple profiles set up in order to use different roles, etc, you should update your ~/.aws/config to specify mfa as the source_profile for any profile the requires MFA.

aws-cli-mfa's People

Contributors

kevin860 avatar

Stargazers

Ethan Sadowski avatar  avatar  avatar

Watchers

 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.