- Newest
- Most votes
- Most comments
The error you're experiencing with ElastiCache API calls in specific regions (af-south-1 and me-central-1) while using assumed roles is likely related to region-specific issues with security tokens.
When you see the "InvalidClientTokenId" error stating that "The security token included in the request is invalid," this typically indicates one of several possible issues:
-
Region activation: Ensure that both the source account (where access_user exists) and the target account (where the role exists) have the specific regions (af-south-1 and me-central-1) enabled. Some AWS regions require explicit opt-in.
-
Role permissions: Verify that the IAM role you're assuming has the necessary permissions to perform ElastiCache operations in those specific regions. The role might have region-specific restrictions in its policies.
-
Token validity: There might be issues with how the temporary security credentials are being used across regions. The default duration for assumed role sessions is 1 hour, so ensure your token hasn't expired.
-
Region-specific restrictions: Check for any organizational policies or service control policies (SCPs) that might restrict ElastiCache actions in those specific regions.
-
CLI configuration: Ensure your AWS CLI is up to date, as older versions might have issues with newer regions.
To troubleshoot this issue:
- Run
aws sts get-caller-identity --profile somerole --region af-south-1to verify your identity is correctly assumed in the problematic regions - Check the IAM policies attached to the role for any region-specific conditions or restrictions
- Verify that the role's trust relationship is properly configured
- Consider adding the
aws:ViaAWSServicecondition to any IP-restricted policies if applicable
If the issue persists, you might need to review the specific permissions required for ElastiCache operations in those regions and ensure your role has the appropriate access.
Sources
An error occurred (UnrecognizedClientException) when calling the ListClusters operation: The security token included in the request is invalid | AWS re:Post
Resolve access denied errors in S3 for IP-restricted IAM roles | AWS re:Post
Relevant content
asked 2 years ago

aws sts get-caller-identity --profile somerole --region af-south-1Fails with the same issue (An error occurred (InvalidClientTokenId) when calling the DescribeCacheClusters operation: The security token included in the request is invalid)while
aws sts get-caller-identity --profile somerole --region us-central-1succeeds, how come?Also there are no conditions attached to the role