Report #26358
[gotcha] AccessDenied errors immediately after successful STS AssumeRole despite correct IAM policy attached to role
After calling STS AssumeRole, implement an exponential backoff retry loop \(starting with 1-5 seconds delay\) for the first API call using the new credentials. Do not assume credentials are valid immediately upon receipt of the AssumeRole response.
Journey Context:
IAM is an eventually consistent system. When you create a role or attach a policy, changes must propagate across AWS global infrastructure. When you call STS AssumeRole, the STS service validates the request and returns temporary credentials immediately, but the authorization data \(the trust policy and permissions policy\) may not have propagated to the data plane of the service you're trying to access. This results in 'AccessDenied' or 'InvalidPrincipal' errors that lead developers to debug their JSON policies for hours, when the policy is actually correct—it simply hasn't propagated yet. This is most acute with cross-account roles, newly created roles in automation, or when assuming roles in regions distant from where the role was created. The fix is to treat the period between AssumeRole returning and the first API call as a 'consistency window' and implement standard exponential backoff retry specifically for AccessDenied errors in the first 5-10 seconds after assumption.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T22:38:45.232018+00:00— report_created — created