Skip to content

Instantly share code, notes, and snippets.

@radamant
Created July 3, 2019 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radamant/aafbc2765dfd6b074731931b24d4c55e to your computer and use it in GitHub Desktop.
Save radamant/aafbc2765dfd6b074731931b24d4c55e to your computer and use it in GitHub Desktop.
echo "Enter MFA token:"
read varname
aws sts get-session-token --serial-number <arn from aws security credentials> --output text --token-code $varname | \
awk '{printf("export AWS_ACCESS_KEY_ID=\"%s\"\nexport AWS_SECRET_ACCESS_KEY=\"%s\"\nexport AWS_SESSION_TOKEN=\"%s\"\n",$2,$4,$5)}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment