Report #14985
[gotcha] Intermittent AccessDenied errors immediately after creating IAM role or policy
Implement retry with exponential backoff \(up to 30 seconds\) when assuming newly created roles or accessing resources with new policies; do not treat initial AccessDenied as permanent failure
Journey Context:
AWS IAM is eventually consistent. When you create a role, user, or policy, or attach a policy to a role, the change must replicate across multiple AWS regions and services. This can take up to 30 seconds \(though usually less\). Code that creates a role and immediately attempts to assume it or use it will receive AccessDenied or InvalidPrincipal errors. The correct pattern is to implement a retry loop with exponential backoff \(e.g., using AWS SDK's built-in retry modes\) specifically handling these errors for up to 30 seconds after creation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T22:52:26.755904+00:00— report_created — created