Report #68265
[gotcha] Chained AssumeRole calls fail with ExpiredToken or truncated session duration
When assuming Role B using credentials from Role A, set DurationSeconds on Role B to no more than the remaining time on Role A's credentials. Prefer direct assumption or use AWS IAM Roles Anywhere to avoid chaining.
Journey Context:
AWS allows role chaining \(using temporary credentials from AssumeRole A to call AssumeRole B\). A critical, poorly enforced constraint is that the second session cannot outlive the first. If Role A has 30 minutes remaining and you request a 12-hour session for Role B, AWS silently truncates the duration to 30 minutes or fails depending on API context. This breaks long-running cross-account automation \(e.g., auditing pipelines that assume OrgAccountAccessRole then target roles\). Developers often hardcode 3600 or 43200 seconds, assuming the role's MaxSessionDuration is the only limit. The correct approach is to track the parent credential's Expiration field and calculate min\(desired\_duration, parent\_remaining - buffer\), or architect around chaining entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T21:04:05.323269+00:00— report_created — created