Report #61841
[gotcha] STS AssumeRole credentials rejected with InvalidClientTokenId immediately after creation
Configure your SDK or HTTP client to retry on InvalidClientTokenId with exponential backoff \(starting at ~200ms\) for up to 5-10 seconds after receiving temporary credentials; do not hardcode fixed sleeps.
Journey Context:
When you call STS AssumeRole, the service returns temporary credentials immediately, but these credentials are replicated across AWS regions and global endpoints. There is a propagation delay \(typically sub-second but observable up to several seconds\) before all AWS service endpoints recognize the new session token. Engineers often assume the credentials are live the moment the HTTP response arrives, leading to immediate subsequent API calls that fail with InvalidClientTokenId. A common wrong fix is a fixed sleep\(5\) which slows automation and remains flaky under high latency. The correct pattern leverages the SDK's built-in retry logic with jitter, treating the propagation delay as a transient fault.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:17:12.106623+00:00— report_created — created