首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >botocore.exceptions.ClientError: InvalidClientTokenId

botocore.exceptions.ClientError: InvalidClientTokenId
EN

Stack Overflow用户
提问于 2017-07-29 00:35:03
回答 2查看 5.8K关注 0票数 2

我浏览了位于以下位置的快速入门:https://boto3.readthedocs.io/en/latest/guide/quickstart.html

我安装了AWS CLI并使用我的有效密钥对其进行了配置。我已经重新检查了~/.aws/credentials和~/.aws/config

此时,我应该能够在命令提示符下使用python bin/process_sqs_messages.py运行py脚本了。脚本如下所示:

代码语言:javascript
复制
__author__ = 'chris'
import boto3

sqs = boto3.client('sqs')

# List SQS queues
response = sqs.list_queues()

print(response['QueueUrls'])

我得到以下错误:

代码语言:javascript
复制
botocore.exceptions.ClientError: An error occurred (InvalidClientTokenId) 
when calling the ListQueues operation: No account found for the given parameters

完整堆栈跟踪:

代码语言:javascript
复制
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

我的猜测是我丢失了一个会话令牌,但我不确定,如果我在哪里/如何获得一个会话令牌?样本完全没有提到这一点。

EN

回答 2

Stack Overflow用户

发布于 2017-07-29 05:39:26

我刚刚创建了一个新用户,它们神奇地又能工作了。我的凭据肯定在某个地方失效了,但该用户仍然存在,并且该用户的凭据在awscli中匹配。

票数 1
EN

Stack Overflow用户

发布于 2021-03-26 14:57:30

在我的例子中,我创建了新的用户/密钥,但它不起作用。此外,我还仔细检查了以下内容。

我的AWS密钥是正确的。

  • 机器时间也是正确的。

是我的旧终端导致了这个问题(我有几个星期没有关闭它了),所以在关闭它之后,我只是重新启动了它,它工作得很好。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45378453

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档