Coder Social home page Coder Social logo

aws-sso-switcher's Introduction

Stop!

This script has been re-implemented using Javascript, making it a lot less error-prone. You can find it HERE.

aws-sso-switcher

Script for on-the-fly switching between temporary AWS credentials through AWS SSO.

Description

I wrote this script to make it easier for me to switch between temporary AWS credentials of many different AWS accounts. At the time of this writing, the AWS Cli v2 does provide this mechanism, however it is required to create an AWS Profile for each account, which is not practical if you're working with many accounts and/or multiple instances of AWS SSO.

Features

  • Creates profiles for different instances of AWS SSO
  • Requests the required access token through the SSO OIDC workflow
  • Refreshes the access token when the current one expires

Requirements

  • AWS Cli v2
  • jq
  • fzf

Setup

Simply clone this repository and run the script. Since the script is not made to be sourced, it simply prints the required export commands for the AWS credential environment variables. You can set up a function in your .bashrc or .zshrc file that can run the export commands like so:

aws-sso-switcher() {
  path/to/your/aws-sso-switcher.sh "$@" | while read -r line; do 
    if [[ $line =~ ^export ]]; then
      eval $line
    else
      echo $line
    fi
  done
}

Usage

Usage: aws-sso-switcher [options]

Helps you fetch temporary credentials to different AWS accounts supplied by AWS SSO.
Requires fzf and jq.

Options:
-p   Your SSO profile. Upon running the script for the first time, it will set one up for you.
-a   Add another SSO profile.
-c   The path for the SSO profile config file.
-h   Print this message.

aws-sso-switcher's People

Contributors

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