Report #4101
[gotcha] IAM role or policy changes not taking effect immediately causing AccessDenied errors
Implement retry logic with exponential backoff \(up to 60 seconds\) specifically catching AccessDenied exceptions when using newly created IAM entities; do not assume immediate global consistency or use static sleeps
Journey Context:
Engineers create an IAM role or attach a policy and immediately invoke a Lambda, EC2 instance, or external API using that role. They receive AccessDenied despite the policy showing correct permissions in the console. IAM is an eventually consistent system. Changes can take up to 60 seconds to propagate globally across all AWS regions and edge locations. Common mistakes include: using time.sleep\(5\) arbitrarily, not distinguishing between propagation delay vs actual permission errors, or retrying only on network errors. The correct pattern is to catch AccessDenied specifically \(not other errors\) and back off with jitter up to 60s. Alternative considered: Using STS GetCallerIdentity to validate \(doesn't help, it's read-only and cached separately\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T18:49:27.099256+00:00— report_created — created