/aws-session

Set environment variables for authenticate against aws api. Assume Role and MFA support.

Primary LanguageShellApache License 2.0Apache-2.0

aws-session

aws-session sets temporary credential environment variables for a given profile.

Features

  • MFA Support
  • Assume Role Support

Supported Shells

  • sh
  • zsh
  • fish

Installation

homebrew

brew install qoomon/tab/aws-session

Manuel

curl -o /usr/local/bin/aws-session https://raw.githubusercontent.com/qoomon/aws-session/master/aws-session

Configuration

Setup profiles you would like to assume in ~/.aws/config => aws cli-roles

Usage

aws-session <profile>

If the session requires MFA, you will be asked for the token

assume assume sets following environment variables and then executes the command

  • AWS_PROFILE
  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_SESSION_TOKEN
  • AWS_DEFAULT_REGION

Examples

Print environment variables commands

aws-session company-production

Utils

If you use eval $(aws-session) frequently, you may want to create a alias for it:

  • zsh
alias aws-session='function(){eval "$(./aws-session $@)"}'
  • bash
function aws-session { eval "$( $(which aws-session) "$@")"; }