Report #98242
[bug\_fix] AWS SDK/CLI: 'The security token included in the request is expired' \(ErrorCode: ExpiredToken\)
Renew the temporary session credentials by re-running the credential source command \(e.g., 'aws sso login', 'aws sts assume-role', or refreshing the IAM Identity Center session\). Then update the active AWS\_ACCESS\_KEY\_ID, AWS\_SECRET\_ACCESS\_KEY, and AWS\_SESSION\_TOKEN environment variables or the credentials file profile with the new values.
Journey Context:
A CI job using an SSO profile starts failing mid-run with ExpiredToken. The developer checks ~/.aws/credentials and sees values, so they assume credentials are fine. They rerun the command and get the same error. They notice the timestamp on the cached SSO token in ~/.aws/sso/cache is from yesterday. Looking at AWS CLI traces, the error comes from STS after it presents the cached access token. The root cause is that SSO login returns temporary credentials that expire after the session duration configured in IAM Identity Center; the local cache is not auto-refreshed unless the CLI has an active login flow. The fix works because it replaces the expired STS session with a fresh one, re-establishing a valid SigV4 signing context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-27T04:38:45.444430+00:00— report_created — created