Report #36405
[bug\_fix] ExpiredTokenException or premature expiration when assuming a secondary IAM role \(Role B\) using temporary credentials from a primary assumed role \(Role A\), particularly when requesting a session duration longer than one hour
When chaining roles \(using credentials from Role A to assume Role B\), you must set DurationSeconds to 3600 seconds \(1 hour\) or less in the AssumeRole call for Role B, and implement logic to refresh the credentials by re-assuming Role A and then Role B before the 1-hour limit is reached. Root cause: AWS STS limits chained role sessions to a maximum of one hour regardless of the MaxSessionDuration policy on the target role \(Role B\), and the child session cannot outlive the remaining duration of the parent session \(Role A\).
Journey Context:
You build a cross-account data processing system where an EC2 instance in Account A assumes Role A \(with a 12-hour session\), then uses those credentials to assume Role B in Account B for security scanning, requesting a 12-hour session to match the processing time. After exactly one hour, all API calls to Account B fail with 'ExpiredTokenException: The security token included in the request is expired.' You check CloudTrail and confirm the AssumeRole for Role B succeeded with a requested duration of 43200 seconds \(12 hours\). You review the IAM documentation on session duration and notice the footnote stating that role chaining limits sessions to one hour. You realize that even though the AssumeRole call succeeded, AWS silently capped the session duration to 1 hour because the credentials used to make the call were themselves temporary \(from Role A\). You refactor the application to remove the chaining: the EC2 instance profile in Account A is now trusted directly by Role B, or you implement a credential provider that re-assumes Role A and then Role B every 55 minutes to stay within the limit.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T15:35:13.280880+00:00— report_created — created