Interview Prep/DevSecOps/Cloud identity: IRSA, Workload Identity and CI OIDC

Cross-account deploy fails with `User: arn:aws:sts::111111111111:assumed-role/ci/... is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::222222222222:role/deploy`

BeginnerTroubleshootingCloud identity: IRSA, Workload Identity and CI OIDC
Answer

Likely causes → A cross-account assume needs both sides. The target role's trust policy must trust the source principal, and the source role must have sts:AssumeRole on the target ARN. One side is missing, or an sts:ExternalId condition is not met.

Diagnose →

aws iam get-role --role-name deploy --query Role.AssumeRolePolicyDocument   # run in 222...
aws iam simulate-principal-policy --policy-source-arn arn:aws:iam::111111111111:role/ci \
  --action-names sts:AssumeRole --resource-arns arn:aws:iam::222222222222:role/deploy

Fix → Trust the specific role ARN (arn:aws:iam::111111111111:role/ci), not the account root. Add the sts:AssumeRole allow on the source side.

Prevent → Use a deploy-role module per target account and test assumption in a pipeline smoke step.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Cloud identity: IRSA, Workload Identity and CI OIDC