Skip to content

Instantly share code, notes, and snippets.

@bitdivine
Created January 24, 2019 16:39
Show Gist options
  • Save bitdivine/9abe667946b56f1e9e459a3939356527 to your computer and use it in GitHub Desktop.
Save bitdivine/9abe667946b56f1e9e459a3939356527 to your computer and use it in GitHub Desktop.
Generate and export an AWS_SESSION_TOKEN
# Add this to your ~/.bashrc
alias aws_session_token_generate='export AWS_SESSION_TOKEN=$(aws sts get-session-token --serial-number "$(aws sts get-caller-identity --query Arn --output text | sed 's/user/mfa/g')" --token-code "$(read line ; echo $line)" --query Credentials.SessionToken --output text)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment