Giter Site home page Giter Site logo

richard-rahl / aws-auth-helper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from coffeeandcode/aws-auth-helper

0.0 0.0 0.0 364 KB

Set AWS environment variables from the credentials returned from a STS `assumeRole` on the command line for subsequent applications.

JavaScript 100.00%

aws-auth-helper's Introduction

AWS Auth Helper

This small application assists with retrieving temporary AWS environment variables from credentials that require 2-factor authentication and assuming an AWS IAM role.

This can be used for requiring a 2-factor authentication code to be entered before applications like Serverless and Apex deploy your Lambda applications.

The temporary credentials are sent to stdout and can be evaled to use them as environment variables in Bash commands.

# As part of your Node project
npm install aws-auth-helper --save

# package.json
...
    "scripts": {
        "deploy": "eval \"`aws-auth-helper` serverless deploy\""
    }
...
# Installed globally
npm install -g aws-auth-helper
eval "`aws-auth-helper [aws-profile-name]` npm run deploy"

The AWS profile is selected by from the first item that matches:

  1. passing a string after the aws-auth-helper command
  2. AWS_PROFILE environment variable
  3. default as the default

If you choose to use AWS_PROFILE make sure that you are passing the environment variable to the (sub)shell that calls aws-auth-helper.

For example:

export AWS_PROFILE && eval \"aws-auth-helper apex deploy\"

Requirements

You must have an AWS profile setup in your ~/.aws/credentials file similar to the following:

[default]
aws_access_key_id = ABCDEFG
aws_secret_access_key = abcdefg

You should also have a role based configuration that uses MFA in your ~/.aws/config file:

[profile default]
mfa_serial = arn:aws:iam::1234567890:mfa/username
output = json
region = us-east-1
role_arn = arn:aws:iam::1234567890:role/DesiredRoleName
source_profile = default

aws-auth-helper's People

Contributors

jonknapp 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.