得到EC2定价编程? [英] get ec2 pricing programmatically?
问题描述
有没有办法让AWS定价编程(每小时每个实例类型的成本,每GB的成本/月存储在S3上的,等)?
Is there a way to get AWS pricing programmatically (cost per hour of each instance type, cost per GB/month of storage on S3, and etc)?
此外,是否有成本的监控工具?例如,有一个工具,可以以小时为单位报告您的EC2实例使用(而不是按月,这正是亚马逊一样)?
Also, are there cost monitoring tools? For example, is there a tool that can report your EC2 instance usage on an hourly basis (versus a monthly basis, which is what Amazon does)?
在此先感谢。
推荐答案
价格表为在JSONP文件的形式提供(你需要去掉函数调用),其使用的AWS定价页面。每个表(以及每个选项卡表)有独立的JSON文件。这不是一个API可能,但绝对计算机消化。下面是支持EC2定价页面(如17 2014年12月)的列表:
The price lists are available in form of JSONP files (you need to strip off function call) which are used by the AWS pricing pages. Each table (and each tab for table) has separate JSON file. It is not an API maybe, but definitely computer digestible. Here is a list that supports EC2 pricing page (as of 17 December 2014):
- 在按需的Linux: HTTP://a0.awsstatic .COM /定价/ 1 / EC2 / Linux的od.min.js
- 在按需的RedHat: HTTP://a0.awsstatic .COM /定价/ 1 / EC2 / RHEL-od.min.js
- 在按需SUSE: HTTP://a0.awsstatic .COM /定价/ 1 / EC2 / SLES-od.min.js
- 在按需的Windows: HTTP://a0.awsstatic .COM /定价/ 1 / EC2 / mswin-od.min.js
- 在按需SQL Standrad:的http:// A0。 awsstatic.com/pricing/1/ec2/mswinSQL-od.min.js
- 在按需SQL网站:的http:// A0。 awsstatic.com/pricing/1/ec2/mswinSQLWeb-od.min.js
- 在保留的Linux: HTTP:/ /a0.awsstatic.com/pricing/1/ec2/ri-v2/linux-unix-shared.min.js
- 保留红帽:的http://a0.awsstatic.com/pricing/1/ec2/ri-v2/red-hat-enterprise-linux-shared.min.js
- 保留SUSE: HTTP:/ /a0.awsstatic.com/pricing/1/ec2/ri-v2/suse-linux-shared.min.js
- 在保留Windows系统:的http:// A0 .awsstatic.com /定价/ 1 / EC2 / RI-V2 / Windows的shared.min.js
- 在保留SQL标准:的http://a0.awsstatic.com/pricing/1/ec2/ri-v2/windows-with-sql-server-standard-shared.min.js
- 在保留SQL网址:的http://a0.awsstatic.com/pricing/1/ec2/ri-v2/windows-with-sql-server-web-shared.min.js
- 在保留现货实例: http://spot-price.s3.amazonaws.com/ spot.js
- 数据传输:的http://a0.awsstatic.com/pricing/1/ec2/pricing-data-transfer-with-regions.min.js
- 在EBS优化:的http:// A0 .awsstatic.com /定价/ 1 / EC2 /定价-EBS优化-instances.min.js
- 在EBS: http://a0.awsstatic.com/定价/ 1 / EBS /定价-ebs.min.js
- 弹性IP: HTTP://a0.awsstatic .COM /定价/ 1 / EC2 /价格弹性,ips.min.js
- 的CloudWatch: http://a0.awsstatic.com/定价/ 1 / CloudWatch的/定价-cloudwatch.min.js
- ELB: http://a0.awsstatic.com/定价/ 1 / EC2 /定价-elb.min.js
- 在电子病历: https://a0.awsstatic.com/定价/ 1 / EMR /定价-emr.min.js
- On-demand Linux: http://a0.awsstatic.com/pricing/1/ec2/linux-od.min.js
- On-demand RedHat: http://a0.awsstatic.com/pricing/1/ec2/rhel-od.min.js
- On-demand SUSE: http://a0.awsstatic.com/pricing/1/ec2/sles-od.min.js
- On-demand Windows: http://a0.awsstatic.com/pricing/1/ec2/mswin-od.min.js
- On-demand SQL Standrad: http://a0.awsstatic.com/pricing/1/ec2/mswinSQL-od.min.js
- On-demand SQL Web: http://a0.awsstatic.com/pricing/1/ec2/mswinSQLWeb-od.min.js
- Reserved Linux: http://a0.awsstatic.com/pricing/1/ec2/ri-v2/linux-unix-shared.min.js
- Reserved RedHat: http://a0.awsstatic.com/pricing/1/ec2/ri-v2/red-hat-enterprise-linux-shared.min.js
- Reserved SUSE: http://a0.awsstatic.com/pricing/1/ec2/ri-v2/suse-linux-shared.min.js
- Reserved Windows: http://a0.awsstatic.com/pricing/1/ec2/ri-v2/windows-shared.min.js
- Reserved SQL Standard: http://a0.awsstatic.com/pricing/1/ec2/ri-v2/windows-with-sql-server-standard-shared.min.js
- Reserved SQL Web: http://a0.awsstatic.com/pricing/1/ec2/ri-v2/windows-with-sql-server-web-shared.min.js
- Reserved Spot instances: http://spot-price.s3.amazonaws.com/spot.js
- Data transfer: http://a0.awsstatic.com/pricing/1/ec2/pricing-data-transfer-with-regions.min.js
- EBS optimized: http://a0.awsstatic.com/pricing/1/ec2/pricing-ebs-optimized-instances.min.js
- EBS: http://a0.awsstatic.com/pricing/1/ebs/pricing-ebs.min.js
- Elastic IP: http://a0.awsstatic.com/pricing/1/ec2/pricing-elastic-ips.min.js
- CloudWatch: http://a0.awsstatic.com/pricing/1/cloudwatch/pricing-cloudwatch.min.js
- ELB: http://a0.awsstatic.com/pricing/1/ec2/pricing-elb.min.js
- EMR: https://a0.awsstatic.com/pricing/1/emr/pricing-emr.min.js
警告:端点改变不时,往往旧的URL仍然存在与旧值。最好是检查什么是当前的状态,而不是依赖于这个主题提供的链接。
WARNING: The endpoints change from time to time and often old URL is still there with old values. It is best to check what is the current status rather than relying on links provided in this thread.
所以,这里是一个简短的命令来获得当前设置或URL任何AWS定价页面。例如基于EC2。在Linux或Cygwin的运行它。实际上,这个命令被用来创建以上列表
So, here is a short command to get current set or URLs from any AWS pricing page. Example based on EC2. Run it on Linux or Cygwin. Actually this command was used to create the list above.
curl http://aws.amazon.com/ec2/pricing/ 2>/dev/null | grep 'model:' | sed -e "s/.*'\(.*\)'.*/http:\\1/"
对于那些谁不喜欢命令行,你也可以检查Web浏览器的网络控制台(你那里有F12),过滤器JS对象:
For those who don't like command line, you can also check in a web browser network console (you get there with F12), filter with JS objects:
这篇关于得到EC2定价编程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!