Report #22592
[bug\_fix] The security token included in the request is expired
Re-assume the role to obtain fresh temporary credentials, and configure the AWS profile with \`role\_arn\` and \`source\_profile\` in \`~/.aws/config\` so the SDK automatically handles rotation instead of caching static temporary credentials.
Journey Context:
Developer runs \`aws s3 ls\` and gets 'The security token included in the request is expired'. They check \`aws configure list\` and see the profile is set. They check \`~/.aws/credentials\` and see temporary keys with a session token. They realize these were from \`aws sts assume-role\` done 3 hours ago. The rabbit hole: they check CloudTrail to see if the role was revoked, check the IAM role's \`MaxSessionDuration\` \(it's 3600 seconds by default\). They realize that when they assumed the role manually, they didn't specify \`--duration-seconds\`, so they got the default 1 hour. Now the credentials are expired but their script is still using the cached values from the credentials file. The fix works because configuring \`role\_arn\` with \`source\_profile\` enables the SDK to use the longer-lived base credentials to automatically call STS and refresh the temporary credentials before they expire, rather than relying on static cached values.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:19:59.310368+00:00— report_created — created