Giter Club home page Giter Club logo

ars's Introduction

ARS - AWS Role Switcher

Requirements

  1. Have AWS credentials file located in ~/.aws/credentials
  2. MacOS or Linux (only tested on MacOS)
  3. Use Google Chrome, Firefox, Safari or Brave Browser

How to setup AWS assume roles

1. Create IAM policy on AWS console (on AWS account you want to access)

Login to the AWS account you want to access (not your origin account), then create IAM policy like below:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::<your-origin-aws-account-id>:root"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}

2. Add IAM policy on AWS account (on your origin AWS account)

Login to your origin account, then add IAM policy to the user you want to give permission to assume the above role like below:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "sts:AssumeRole",
      "Resource": "arn:aws:iam::<aws-account-id-you-want-to-access>:role/<role-name>"
    }
  ]
}

3. Update AWS credentials file

Update .aws/credentials file

[my-aws-profile]
aws_access_key_id = XXXX
aws_secret_access_key = XXXX

[my-role]
role_arn = arn:aws:iam::<role-account-id>:role/<role-name>
source_profile = my-aws-profile

Installation

  1. Download the binary
    • OSX ? Download bin/osx/ars.tar.gz
    • Linux ? Download bin/linux/ars.tar.gz
  2. Extract the file. Tip: If you're using terminal -> run tar -xzvf ars.tar.gz
  3. Copy the extracted file to usr/local/bin. Tip: If you're using terminal -> run cp ars /usr/local/bin

Usage

$ ars --help
Usage of ars:
  -ask-redirect-url
      Prompt redirect URL
  -browser string
      Browser to open AWS Console. Accepted values: firefox, chrome, safari, brave (default "chrome")
  -redirect-url string
      Redirect URL after login (default "https://<profile_region>.console.aws.amazon.com")

ars's People

Stargazers

 avatar

Watchers

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