GithubHelp home page GithubHelp logo

arar's Introduction

arar: Assume Role And Run

arar: Assume Role And Run performs assume-role and run a command with that credentials.

Context

Combination with AWS_ACCESS_KEY_ID and AWS_PROFILE environment variables doesn't allow assume-role. You must pass AWS_PROFILE without environment variables, e.g. with --profile:

# This doesn't work as expected. This just result the identity of the IAM user with AWS_ACCESS_KEY_ID
AWS_ACCESS_KEY_ID=xxx \
AWS_SECRET_ACCESS_KEY=xxx \
AWS_PROFILE=assume-roling-profile \
aws sts get-caller-identity

And you cannot specify the role to assume with environment variable. You always need setup .aws/config . (Actually, you should use Web Identity for those situations if you could.)

Those limitations are really hard to use in CI/CD. arar provides those mechanisms.

Install

Download binary from Releases.

Usage

You can peerform assume-role like this:

AWS_ACCESS_KEY_ID=xxx \
AWS_SECRET_ACCESS_KEY=xxx \
AWS_REGION=us-east-1 \
AWS_ROLE_ARN=arn:aws:iam::xxxxxxxxxx:role/assumerole-role \
AWS_ROLE_SESSION_NAME=assumerole-user \
arar -- aws sts get-caller-identity

Also supports command line options (aws sts assume-role compatible):

AWS_ACCESS_KEY_ID=xxx \
AWS_SECRET_ACCESS_KEY=xxx \
arar \
  --region=ap-northeast-1 \
  --role-arn=arn:aws:iam::xxxxxxxxxxx:role/assumerole-role \
  --role-session-name=assumerole-user
  -- \
  aws sts get-caller-identity

MFA support

Supports token codes with MFA devices:

arar \
  --serial-number=arn:aws:iam::xxxxxxxxxxx:mfa/assumeroling-user
  -- \
  aws sts get-caller-identity

Automatic session name with IAM user name

-u/--username-session option sets the session name with IAM user name. This is useful when the role is configured with "sts:RoleSessionName": "${aws:username}". (AWS Security Blog post).

arar -u -- aws sts get-caller-identity

License

MIT

arar's People

Contributors

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