Created
August 22, 2018 15:43
-
-
Save wobondar/b02b01e5264e2d7a780e83e83561e4bd to your computer and use it in GitHub Desktop.
AWS CodeBuild container credentials
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| curl -qL 169.254.170.2/$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI > credentials.json | |
| mkdir -p ~/.aws | |
| echo "[default]" > ~/.aws/credentials | |
| echo "aws_access_key_id = $(cat credentials.json | jq '.AccessKeyId' | sed s'/"//g')" >> ~/.aws/credentials | |
| echo "aws_secret_access_key = $(cat credentials.json | jq '.SecretAccessKey' | sed s'/"//g')" >> ~/.aws/credentials | |
| echo "aws_session_token = $(cat credentials.json | jq '.Token' | sed s'/"//g')" >> ~/.aws/credentials | |
| rm credentials.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment