Skip to content

Instantly share code, notes, and snippets.

@jonnyyu
Forked from cliv/config
Last active May 5, 2022 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jonnyyu/82d44cda852c1d49c9aa1b408c94cf4c to your computer and use it in GitHub Desktop.
Save jonnyyu/82d44cda852c1d49c9aa1b408c94cf4c to your computer and use it in GitHub Desktop.
# add to ~/.aws/config and add the path to your folder.
[profile vscode]
region = us-west-2
credential_process = /home/ec2-user/.aws/get_credentials_vscode.sh
#!/bin/bash
# Place in ~/.aws
JQ=`which jq`
CURL=`which curl`
ROLE_NAME="EC2_ASSIGNED_ROLE"
if [ -z "$JQ" ] || [ -z "$CURL" ]
then
echo "Required programs missing."
echo "JQ: $JQ"
echo "CURL: $CURL"
exit 1
fi
$CURL -s http://169.254.169.254/latest/meta-data/iam/security-credentials/${ROLE_NAME} | $JQ '.Version = 1 | .SessionToken = .Token | del(.Token, .Type, .Code, .LastUpdated)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment