Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

botocore.exceptions.ClientError: InvalidClientTokenId

I went through the quickstart located here: https://boto3.readthedocs.io/en/latest/guide/quickstart.html

I installed the AWS CLI and configured it with my valid keys. I've double checked in the ~/.aws/credentials and ~/.aws/config

At this point I should be able to run my py script with python bin/process_sqs_messages.py at the command prompt. The script looks like this:

__author__ = 'chris'
import boto3

sqs = boto3.client('sqs')

# List SQS queues
response = sqs.list_queues()

print(response['QueueUrls'])

I get the following error:

botocore.exceptions.ClientError: An error occurred (InvalidClientTokenId) 
when calling the ListQueues operation: No account found for the given parameters

Full stack trace:

Traceback (most recent call last):
File "bin/process_sqs_messages.py", line 12, in <module>
response = client.list_queues()
File "/Users/xxxx/.environments/xxxx_env/lib/python3.6/site-packages/botocore/client.py", line 310, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/Users/xxxxx/.environments/xxxxx_env/lib/python3.6/site-packages/botocore/client.py", line 599, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidClientTokenId) when calling the ListQueues operation: No account found for the given parameters

My guess is that i'm missing a session token, but i'm not sure and if I am where/how do I get one? The sample doesn't mention it at all.

like image 449
Chris Avatar asked Dec 09 '25 14:12

Chris


1 Answers

I just created a new user and magically they work again. Must have had my credentials invalidated somewhere, but that user still existed and that user's credentials matched inside awscli.

like image 186
Chris Avatar answered Dec 11 '25 20:12

Chris