我浏览了位于以下位置的快速入门:https://boto3.readthedocs.io/en/latest/guide/quickstart.html
我安装了AWS CLI并使用我的有效密钥对其进行了配置。我已经重新检查了~/.aws/credentials和~/.aws/config
此时,我应该能够在命令提示符下使用python bin/process_sqs_messages.py运行py脚本了。脚本如下所示:
__author__ = 'chris'
import boto3
sqs = boto3.client('sqs')
# List SQS queues
response = sqs.list_queues()
print(response['QueueUrls'])我得到以下错误:
botocore.exceptions.ClientError: An error occurred (InvalidClientTokenId)
when calling the ListQueues operation: No account found for the given parameters完整堆栈跟踪:
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我的猜测是我丢失了一个会话令牌,但我不确定,如果我在哪里/如何获得一个会话令牌?样本完全没有提到这一点。
发布于 2017-07-29 05:39:26
我刚刚创建了一个新用户,它们神奇地又能工作了。我的凭据肯定在某个地方失效了,但该用户仍然存在,并且该用户的凭据在awscli中匹配。
发布于 2021-03-26 14:57:30
在我的例子中,我创建了新的用户/密钥,但它不起作用。此外,我还仔细检查了以下内容。
我的AWS密钥是正确的。
是我的旧终端导致了这个问题(我有几个星期没有关闭它了),所以在关闭它之后,我只是重新启动了它,它工作得很好。
https://stackoverflow.com/questions/45378453
复制相似问题