Would an IAM token without X-Amz-Security-Token work? #9320
Replies: 1 comment 1 reply
-
|
If you are using temporary AWS credentials (anything from STS: assumed roles, SSO, IMDS role creds, MFA sessions), then the session token is part of the credentials and it must be sent with the request as So, an “IAM auth token” for RDS/RDS Proxy that is generated from temporary credentials but does NOT include How
Why “aws sts get-caller-identity made it work” in the old issue Calling What it can do is force the AWS credential provider chain to resolve/refresh credentials so the process has a complete, consistent set of credentials (AccessKeyId + SecretAccessKey + SessionToken when applicable). After that refresh, subsequent token generation can include the session token correctly. Intermittent missing You are sometimes generating the token with incomplete environment variables (e.g., AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY set, but AWS_SESSION_TOKEN missing). You have multiple credential sources (env vars + shared config + SSO/IMDS) and the process occasionally picks a source that lacks a session token. Your application caches credentials and does not refresh them consistently, so sometimes it generates tokens with stale/partial creds. What to do (reliable fix) Ensure that when you are using temporary credentials, you always provide the full trio: AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN Or avoid env-var partials and let the SDK/CLI resolve credentials from a single consistent provider (SSO profile, role, IMDS, etc.). And verify which credentials you are actually using at runtime by checking the caller identity once per session (or on refresh), not on every request: aws sts get-caller-identity Summary Temporary credentials require
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I came across to this old issue because my app had intermittently failed with IAM authentication to RDS Proxy due to missing the
X-Amz-Security-Tokenparameter. The issue was closed as it started working by executingaws sts get-caller-identityand it was said "The tokens are still missing the fieldX-Amz-Security-Tokenbut still seem to work fine without it".I get confused because the IAM API reference is saying that
X-Amz-Security-Tokenmust be included while using temporary security credentials from AWS STS. Can anyone elaborate how an IAM token withoutX-Amz-Security-Tokengenerated byaws rds generate-db-auth-tokenwould be authenticated and how the GetCallerIdentity would help?Beta Was this translation helpful? Give feedback.
All reactions