Skip to content

Instantly share code, notes, and snippets.

@ottokruse
Created January 11, 2022 13:34
Embed
What would you like to do?
AWS CLI assume role in AWS CodeBuild through ECS credentials
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