我已经创建了一个小型python脚本,它只是查询某些实例的AWS现货定价,这是昨天的工作,并且已经过去了一周。然而,尽管使用不同的凭据机器我跑这对正在接受以下错误:Boto3:尝试使用EC2查询AWS时出现AuthFailure
aws_query = client.describe_spot_price_history(
StartTime=today,
EndTime=today,
InstanceTypes=[
'g2.2xlarge'
],
ProductDescriptions=[
'Linux/UNIX',
],
MaxResults=3
)
这将返回以下:
botocore.exceptions.ClientError: An error occurred (AuthFailure) when calling the DescribeSpotPriceHistory operation: AWS was not able to validate the provided access credentials
我理解错误,但它是没有意义的。与正在运行的实例关联的IAM角色明确具有执行此操作的权限。
我想不出有什么变化会影响到这一点。
注意,这个脚本从我的本地机器运行良好。
有没有人有任何想法可能造成这种情况?
作为一种替代方案 - 有谁知道我可以如何让Boto3确认它使用的凭证?
如何测试策略模拟器中的角色? https://policysim.aws.amazon.com/ – mootmoot
@mootmoot我会添加我自己的答案。问题实际上最终成为服务器上的时间同步问题。 – Dandy
您能否将问题提交给AWS论坛?虽然这很少见,但我没有发现STS提到的时区要求。所以如果AWS更新他们的文档,这会很有帮助。 – mootmoot