Reputation: 1
Amazon SQS throughing following error:
Error: InvalidClientTokenId: The security token included in the request is invalid
I am using environment variable AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
to create the session. Both key and secret are valid. I found the following URL regarding this issue:
https://aws.amazon.com/premiumsupport/knowledge-center/security-token-expired/
It says:
All application API requests to Amazon Web Services (AWS) must be cryptographically signed using credentials issued by AWS.
If your application uses temporary credentials when creating an AWS client (such as an AmazonSQS client), the credentials expire at the time interval specified during their creation. You must make sure that the credentials are refreshed before they expire."
Do credentials created through environment variables(AWS_KEY and AWS_SECRET) requires them to refresh? Or what is the default credentials expiry limit created through environment variables?
Upvotes: 0
Views: 1760
Reputation: 475
The same thing was happening with me when I discovered that the application was using the values for AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
which were old and had been rotated. Switching to the latest credentials from AWS fixed this for me.
Upvotes: 1