Skip to content

vandrewskis/assume-aws-role

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

assume-aws-role

Work with multiple AWS accounts more easily.

If you currently manage multiple AWS accounts and use role switching to do work in them, this is the tool for you!

Requirements

Prerequisites

Configured profile with AWS CLI for cross account access.

Usage

First, you need to install the tool from NPM:

npm install -g vandrewskis/assume-aws-role

You can assume the role for profile sandbox:

assume-aws-role sandbox

or with MFA token

assume-aws-role sandbox --mfa-token 123456

Now you've got a shell with your temporary security credentials in the environment:

(assume-aws-role sandbox)$

How does it work?

Profiles are configured per Configuring the AWS CLI.

assume-aws-role uses the STS:AssumeRole API to assume the role you specified.

After receiving valid credentials assume-aws-role will spawn the shell specified in $SHELL with the environment modified to include AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN. The environment also includes an overridden PS1 with a minimal custom prompt, and ASSUME_AWS_ROLE with the role so you can fully customize the PS1 prompt by yourself.

About

Work with multiple AWS accounts more easily

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%