Created
January 11, 2022 13:34
-
-
Save ottokruse/1eea8be3509d822749c2b1d4b0537b98 to your computer and use it in GitHub Desktop.
AWS CLI assume role in AWS CodeBuild through ECS credentials
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: | |
- | | |
cat << EOF > aws_config | |
[profile test] | |
role_arn = arn:aws:iam::123456789012:role/my-role-to-assume | |
role_session_name = IntegrationTest | |
credential_source = EcsContainer | |
EOF | |
- export AWS_CONFIG_FILE=./aws_config | |
- aws sts get-caller-identity --profile test # Uses the assumed role |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment