Report #91038
[bug\_fix] AWS Error: The security token included in the request is invalid when using temporary credentials without session token
Set the AWS\_SESSION\_TOKEN environment variable \(or aws\_session\_token in ~/.aws/credentials\) with the SessionToken value provided by STS when assuming a role. The root cause is that temporary credentials obtained via STS AssumeRole or AWS SSO include a Session Token that must be included in the signature. If only the Access Key and Secret Key are provided without the Session Token, AWS treats the credentials as invalid or as long-term credentials that don't match the temporary Access Key ID format \(which starts with ASIA...\).
Journey Context:
Developer uses AWS SSO to authenticate via 'aws sso login'. They export credentials using a script or manually copy the Access Key and Secret Key from the SSO portal into their shell environment variables AWS\_ACCESS\_KEY\_ID and AWS\_SECRET\_ACCESS\_KEY. They run 'aws s3 ls' and get 'The security token included in the request is invalid'. They check the IAM console and confirm their user has permissions. They notice the Access Key ID starts with 'ASIA' \(indicating temporary credentials\) but they don't have AWS\_SESSION\_TOKEN set. They check the SSO export output and see there was a SessionToken field they missed. They export AWS\_SESSION\_TOKEN= and the AWS CLI commands work immediately.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T11:24:05.674733+00:00— report_created — created