Report #50879
[bug\_fix] AWS Missing Session Token for temporary credentials: InvalidClientTokenId: The security token included in the request is invalid
When using temporary credentials obtained via STS AssumeRole, GetSessionToken, or from an EC2 instance profile, you must export the \`AWS\_SESSION\_TOKEN\` \(or \`AWS\_SECURITY\_TOKEN\` for legacy SDKs\) environment variable alongside \`AWS\_ACCESS\_KEY\_ID\` and \`AWS\_SECRET\_ACCESS\_KEY\`. If the key ID starts with 'ASIA', it is temporary and requires the session token.
Journey Context:
A developer is writing a deployment script that assumes a cross-account IAM role using \`aws sts assume-role\`. They parse the JSON output with \`jq\` and export \`AWS\_ACCESS\_KEY\_ID\` and \`AWS\_SECRET\_ACCESS\_KEY\` from the \`Credentials\` object. They run \`aws s3 ls\` and receive 'InvalidClientTokenId: The security token included in the request is invalid'. They check the key ID; it starts with 'ASIA' which indicates temporary credentials. They search the error online and find StackOverflow posts explaining that 'ASIA'-prefixed keys require a session token. They check their environment variables and realize they forgot to export \`AWS\_SESSION\_TOKEN\` \(which was in the \`assume-role\` output as \`SessionToken\`\). They export it as \`AWS\_SESSION\_TOKEN\`, run the CLI again, and it works. They realize that temporary credentials are a triad \(Access Key, Secret Key, Session Token\), not a pair, and that the 'ASIA' prefix is the visual cue.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T15:52:58.032335+00:00— report_created — created