Report #21388
[bug\_fix] The requested DurationSeconds exceeds the MaxSessionDuration set for this role \(AWS STS\)
Reduce the \`DurationSeconds\` parameter in the \`AssumeRole\` call to be less than or equal to the IAM role's \`MaxSessionDuration\` \(default 3600 seconds/1 hour, maximum 43200/12 hours\). Alternatively, increase the role's \`MaxSessionDuration\` by using \`aws iam update-role --role-name --max-session-duration \` \(requires IAM permissions\). The root cause is that the role configuration caps the session length regardless of what the client requests.
Journey Context:
A developer writes a Python script using boto3 to assume a cross-account role for long-running ETL jobs. They use \`sts.assume\_role\(RoleArn='arn:aws:iam::ACCOUNT:role/MyRole', DurationSeconds=43200\)\` \(12 hours\). They get \`ValidationError: The requested DurationSeconds exceeds the MaxSessionDuration set for this role\`. They check the IAM console for \`MyRole\`; the "Maximum session duration" is set to 1 hour \(3600s\), the default. They realize the role was created with the default. They have two options: change their code to request 3600s and handle re-assumption logic, or update the role's max duration. Since they need 12 hours, they run \`aws iam update-role --role-name MyRole --max-session-duration 43200\`. The script works without code changes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T14:18:42.389899+00:00— report_created — created