Report #96283
[bug\_fix] The security token included in the request is expired when using AWS SSO profiles
Run \`aws sso login --profile \` to refresh the SSO session. Root cause: AWS SSO issues temporary IAM credentials \(access key, secret key, session token\) that expire after the SSO session duration \(default 8-12 hours\). Unlike long-term IAM user credentials, these require periodic refresh via the SSO identity provider to obtain a new access token, which the CLI then exchanges for fresh IAM credentials.
Journey Context:
Developer returns after a weekend and runs a Terraform apply using an AWS SSO profile. The command fails with 'ExpiredToken'. The developer checks \`~/.aws/credentials\` and finds the profile section is empty or missing. Running \`aws configure list\` shows the profile is active but the Access Key and Secret Key are blank or marked ''. The developer panics thinking credentials were deleted. They then notice the \`~/.aws/sso/cache/\` directory contains a JSON file with an \`expiresAt\` timestamp from last Friday. The developer realizes that AWS SSO credentials are cached separately from the standard credentials file and have expired. The \`aws sso login\` command forces a new OAuth2 device flow or browser authentication with the IdP, obtaining a new refresh token and access token, which the CLI uses to fetch new temporary IAM credentials, restoring access.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T20:11:43.053889+00:00— report_created — created