【发布时间】:2017-09-21 00:32:11
【问题描述】:
我正在尝试使用 get_spot_price_history() 函数在 python 中通过 boto 获取当前现货价格。
conn = boto.connect_ec2(aws_key, aws_secret)
prices = conn.get_spot_price_history("m3.medium", '2017-04-20T21:14:45.000Z', '2017-04-20T21:20:45.000Z',"us-east-1")
报错
Traceback (most recent call last):
File "run.py", line 22, in <module>
prices = conn.get_spot_price_history("m3.medium", '2017-04-20T21:14:45.000Z', '2017-04-20T21:20:45.000Z',"us-east-1")
File "/usr/lib/python2.6/site-packages/boto/ec2/connection.py", line 1421, in get_spot_price_history
[('item', SpotPriceHistory)], verb='POST')
File "/usr/lib/python2.6/site-packages/boto/connection.py", line 1182, in get_list
raise self.ResponseError(response.status, response.reason, body)
boto.exception.EC2ResponseError: EC2ResponseError: 400 Bad Request
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>InvalidRequest</Code><Message>The request received was invalid.</Message></Error></Errors><RequestID>da79e2ba-7475-4133-98f3-3c6aab8a07c6</RequestID></Response>
我的目标是获取现货实例的当前价格。谁能告诉我我做错了什么或其他一些简单的方法/功能来获得现货的市场价值。 我是亚马逊网络服务的新手。请帮忙。
【问题讨论】:
标签: python amazon-ec2 boto