aws-session
sets temporary credential environment variables for a given profile.
- MFA Support
- Assume Role Support
- sh
- zsh
- fish
brew install qoomon/tab/aws-session
curl -o /usr/local/bin/aws-session https://raw.githubusercontent.com/qoomon/aws-session/master/aws-session
Setup profiles you would like to assume in ~/.aws/config
=> aws cli-roles
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
aws-session company-production
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) "$@")"; }