Created
October 30, 2020 12:58
-
-
Save jeshan/baebf6b23237c93af6dfaad4d3a87351 to your computer and use it in GitHub Desktop.
How to pass environment variables to other processes in AWS Codebuild, e.g docker compose commands
This file contains 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
{ | |
"version": 0.2, | |
"phases": { | |
"build": { | |
"commands": [ | |
"curl 169.254.170.2$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI > creds_json", | |
"export AWS_ACCESS_KEY_ID=$(cat creds_json | jq .AccessKeyId |tr -d '\"')", | |
"export AWS_SECRET_ACCESS_KEY=$(cat creds_json | jq .SecretAccessKey | tr -d '\"')", | |
"export AWS_SESSION_TOKEN=$(cat creds_json | jq .Token |tr -d '\"')", | |
"export CDK_DEFAULT_ACCOUNT=$CDK_DEFAULT_ACCOUNT", | |
"export CDK_DEFAULT_REGION=$CDK_DEFAULT_REGION", | |
"docker-compose up --build" | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment