Skip to content

CICD-262 · AWS STS role assumption ​

Encyclopedia · Cloud infrastructure integration · All snippets

Previous · CICD-261 · Next · CICD-263

1. Where it fits ​

  • Placement CI run step or authorized lab terminal.
  • Prerequisites provider CLI, scoped CI identity, test environment and provider configuration for named resource.
  • Platforms github-actions, cloud-cli.
  • Parameters AWS_ROLE_ARN.

2. Copy the snippet ​

bash
aws sts assume-role --role-arn "${AWS_ROLE_ARN:?}" --role-session-name ci-deploy --duration-seconds 900 --query 'AssumedRoleUser.Arn' --output text

3. How it works ​

STS returns temporary identity or role evidence. Keep the secret-bearing credential fields outside ordinary command output.

4. Verify the result ​

This probe shows the assumed principal without exporting credentials. Use the official action or a vetted credential process for subsequent calls.

Validation syntax-validated (Bash parse). Status definitions.