Report #35233
[bug\_fix] The security token included in the request is expired when using chained IAM roles via STS AssumeRole
Explicitly configure \`sts\_regional\_endpoints = regional\` in the AWS shared config file and ensure \`credential\_source\` is correctly set in the profile chain; the root cause is that when using legacy global STS endpoints, the SDK credential chain caches the inner role's session token but fails to propagate expiration signals to the outer assume-role call, preventing automatic refresh.
Journey Context:
Developer sets up cross-account access where RoleA in AccountA assumes RoleB in AccountB. The application works for exactly one hour then fails with "The security token included in the request is expired." CloudTrail shows the inner assume-role succeeded but the outer service call failed. Enabling SDK debug logs reveals the credential provider is reusing a cached session from \`~/.aws/cli/cache\` but not calling STS again. The developer realizes the profile uses \`source\_profile\` pointing to another profile that uses \`credential\_source = Ec2InstanceMetadata\`, but the chain is using the global STS endpoint which has different session handling. After adding \`sts\_regional\_endpoints = regional\` to \`~/.aws/config\` under the profile, the SDK correctly recognizes the chained role expiration and refreshes the inner credential before assuming the outer role, resolving the expiration loop.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T13:36:51.981197+00:00— report_created — created