是否有任何的API为Amazon Web服务定价? [英] Are there any API's for Amazon Web Services PRICING?
问题描述
是否有最多最新的定价在Amazon Web Services API的任何的?的东西,可以进行查询,例如,最新的价格S3中对于给定的区域,或EC2等
Are there any API's that have up-to-date pricing on Amazon Web Services? Something that can be queried, for example, for the latest price S3 for a given region, or EC2, etc.
感谢
推荐答案
这是我已要求(通过AWS传道者和调查)previously,但一直没有到位。我猜AWS的人对他们的视野更有趣的创新。
This is something I have asked for (via AWS evangelists and surveys) previously, but hasn't been forthcoming. I guess the AWS folks have more interesting innovations on their horizon.
正如刚才@brokenbeatnik,对于现货价格的历史的API。 API文档在这里:<一href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSpotPriceHistory.html">http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSpotPriceHistory.html
As pointed out by @brokenbeatnik, there is an API for spot-price history. API docs here: http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSpotPriceHistory.html
我觉得很奇怪,现货价格历史上有一个官方的API,但是,他们并没有在同一时间进行点播服务做到这一点。总之,要回答这个问题,是可以查询的发布的AWS定价
I find it odd that the spot-price history has an official API, but that they didn't do this for on-demand services at the same time. Anyway, to answer the question, yes you can query the advertised AWS pricing...
我能想出是审查各种服务的定价页的(客户端)来源是最好的。其中你会发现,这些表是建立在JS和填充JSON数据,数据就可以得到自己。例如:
The best I can come up with is from examining the (client-side) source of the various services' pricing pages. Therein you'll find that the tables are built in JS and populated with JSON data, data that you can GET yourself. E.g.:
- <一个href="http://aws.amazon.com/ec2/pricing/pricing-on-demand-instances.json">http://aws.amazon.com/ec2/pricing/pricing-on-demand-instances.json
- <一个href="http://aws.amazon.com/s3/pricing/pricing-storage.json">http://aws.amazon.com/s3/pricing/pricing-storage.json
- http://aws.amazon.com/ec2/pricing/pricing-on-demand-instances.json
- http://aws.amazon.com/s3/pricing/pricing-storage.json
这只是成功的一半,虽然,接下来你必须选择分开的对象格式来获得你想要的值,例如,在Python这得到了Hi-CPU点播超大型Linux实例的价格为弗吉尼亚州:
That's only half the battle though, next you have to pick apart the object format to get at the values you want, e.g., in Python this gets the Hi-CPU On-Demand Extra-Large Linux Instance pricing for Virginia:
>>> import json
>>> import urllib2
>>> response = urllib2.urlopen('http://aws.amazon.com/ec2/pricing/pricing-on-demand-instances.json')
>>> pricejson = response.read()
>>> pricing = json.loads(pricejson)
>>> pricing['config']['regions'][0]['instanceTypes'][3]['sizes'][1]['valueColumns'][0]['prices']['USD']
u'0.68'
免责声明:显然,这不是一个AWS认可的API,因此我不建议期望的数据格式的稳定性,甚至继续存在的来源。但它的存在,它击败转录定价数据为静态配置/源文件!
Disclaimer: Obviously this is not an AWS sanctioned API and as such I wouldn't recommend expecting stability of the data format or even continued existence of the source. But it's there, and it beats transcribing the pricing data into static config/source files!
这篇关于是否有任何的API为Amazon Web服务定价?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!