Skip to content

Instantly share code, notes, and snippets.

@mafonso
Created May 5, 2016 08:32
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 mafonso/d9d07f8f729455c63d80d1ce33fbfaa0 to your computer and use it in GitHub Desktop.
Save mafonso/d9d07f8f729455c63d80d1ce33fbfaa0 to your computer and use it in GitHub Desktop.
role credentials
instance_profile=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/`
aws_access_key_id=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep AccessKeyId | cut -d':' -f2 | sed 's/[^0-9A-Z]*//g'`
aws_secret_access_key=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep SecretAccessKey | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'`
export AWS_ACCESS_KEY_ID=${aws_access_key_id}
export AWS_SECRET_ACCESS_KEY=${aws_secret_access_key}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment