Skip to content

Instantly share code, notes, and snippets.

@dougneal
Created July 6, 2017 09:10
Show Gist options
  • Save dougneal/0806d732821bcf1d3c85830526d3735c to your computer and use it in GitHub Desktop.
Save dougneal/0806d732821bcf1d3c85830526d3735c to your computer and use it in GitHub Desktop.
URL="http://169.254.169.254/latest/meta-data/iam/security-credentials/$1"
echo "export AWS_DEFAULT_REGION=\"eu-west-1\""
echo "export AWS_ACCESS_KEY_ID=\"$(curl $URL 2>/dev/null | jq -r '.AccessKeyId')\""
echo "export AWS_SECRET_ACCESS_KEY=\"$(curl $URL 2>/dev/null | jq -r '.SecretAccessKey')\""
echo "export AWS_SESSION_TOKEN=\"$(curl $URL 2>/dev/null | jq -r '.Token')\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment