You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to get an IAM role details for a role in GovCloud (specified region as us-gov-west-1) while using a cli that's configured with short-term credentials (ASIA...) and an aws_session_token set. I can perform API queries to other services (e.g., STS, S3, Lambda), but IAM throws the following error (also tried via boto3): botocore.exceptions.ClientError: An error occurred (InvalidClientTokenId) when calling the GetRole operation: The security token included in the request is invalid
I have verified that the endpoint is correct (iam.us-gov.amazonaws.com), and when I created the short term credentials with sts get-session-token I specified the region.
When I use permanent access credentials, this works fine, but the short term credentials fail for IAM specifically.
Expected Behavior
Like when aws cli is configured with static, long-term creds, I expect to see the role details for the specified role.
For a GovCloud account, get a temporary session token with aws sts get-session-token, then configure the AWS CLI with those values, use aws configure set aws_session_token TOKEN to set the session token. Then try to perform an IAM get-role call.
This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
Describe the bug
I am trying to get an IAM role details for a role in GovCloud (specified region as
us-gov-west-1
) while using a cli that's configured with short-term credentials (ASIA...
) and anaws_session_token
set. I can perform API queries to other services (e.g., STS, S3, Lambda), but IAM throws the following error (also tried via boto3):botocore.exceptions.ClientError: An error occurred (InvalidClientTokenId) when calling the GetRole operation: The security token included in the request is invalid
I have verified that the endpoint is correct (
iam.us-gov.amazonaws.com
), and when I created the short term credentials withsts get-session-token
I specified the region.When I use permanent access credentials, this works fine, but the short term credentials fail for IAM specifically.
Expected Behavior
Like when aws cli is configured with static, long-term creds, I expect to see the role details for the specified role.
Current Behavior
Reproduction Steps
For a GovCloud account, get a temporary session token with
aws sts get-session-token
, then configure the AWS CLI with those values, useaws configure set aws_session_token TOKEN
to set the session token. Then try to perform an IAM get-role call.Possible Solution
No response
Additional Information/Context
No response
CLI version used
aws-cli/2.17.49
Environment details (OS name and version, etc.)
aws-cli/2.17.49 Python/3.11.9 Darwin/23.6.0 exe/x86_64
The text was updated successfully, but these errors were encountered: