Report #22305
[gotcha] STS AssumeRole fails with AccessDenied immediately after IAM Role creation
Insert a 10-60 second sleep or exponential backoff between \`iam create-role\` and \`sts assume-role\`; do not treat IAM changes as immediately consistent.
Journey Context:
Automation scripts and CI/CD pipelines frequently create a role, attach a policy, and immediately try to assume it to run tests, failing with 'Role not found' or 'AccessDenied'. IAM is a globally distributed system; writes to the IAM control plane must replicate to all regional STS endpoints. The common mistake is to retry instantly \(milliseconds\) which is insufficient. The correct pattern is to treat IAM like a distributed database with eventual consistency: wait for at least 10 seconds \(AWS recommends up to 60\) or implement an idempotent retry loop with backoff until \`AssumeRole\` succeeds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T15:51:01.158109+00:00— report_created — created