Get ec2 software programmatically?

Is there a way to get the AWS software score programmatically (cost per hour of each instance type, cost of one GB / month of storage on S3, etc.)?

In addition, are cost monitoring tools in place? For example, is there a tool that can report usage of your EC2 instance on an hourly basis (compared to the monthly base, what does Amazon do)?

Thanks in advance.

+31
amazon-web-services amazon-ec2
Sep 07 '11 at 12:40
source share
9 answers

UPDATE:

There is currently an AWS evaluation API: https://aws.amazon.com/blogs/aws/new-aws-price-list-api/

The usual answer is:

Price lists are available as JSONP files (you need to disable function calls) that are used by AWS pricing pages. Each table (and each tab for the table) has a separate JSON file. This may not be an API, but it is certainly computer-digestible. Here is the list that supports the EC2 pricing page (as of December 17, 2014):

WARNING: Endpoints change from time to time, and often the old URL still exists with the old values. It’s best to check what the current status is, rather than relying on the links provided in this thread.

So here's a short command to get the current set or URLs from any AWS pricing page. An example based on EC2. Run it on Linux or Cygwin. In fact, 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/" 

For those who do not like the command line, you can also check the network console of the web browser (you get there with F12), filter with JS objects:

enter image description here

+53
Sep 07 '11 at 12:52
source share

Just to let you know that they seem to have changed JSON addresses. It includes new types of C3 instances.

Update 01/21/2014 : Addresses changed again. Please note that these are JS files with a callback function that must be deleted before it becomes parsed JSON.

Update 09/21/2014 : Addresses changed again to include new T2 types. To be processed as JSON files, the original comments and callback function must be removed and the keys must be enclosed in double quotes.

Upon request

Reserved light

Reserved Medium

Reserved Heavy

Other

Previous Endpoint: http://aws-assets-pricing-prod.s3.amazonaws.com/pricing/ec2/linux-od.js

+36
Nov 20 '13 at 20:32
source share

This ruby ​​gemstone wraps JSON valuation data provided by Amazon and provides a simple interface that allows you to map the names of regions and instance types to those used in the EC2 API.

https://github.com/sonian/amazon-pricing

+3
Nov 09 '12 at 19:14
source share
+1
Dec 11 '15 at 6:48
source share

In addition to @arturhoo's answer , which contains EC2 points

You can get historical prices with the CLI tool

 aws ec2 describe-spot-price-history \ --instance-types m1.xlarge \ --product-description "Linux/UNIX (Amazon VPC)" \ --start-time 2016-10-31T03:00:00 \ --end-time 2016-10-31T03:16:00 \ --query 'SpotPriceHistory[*].[Timestamp,SpotPrice]' 

which takes the spot price between 3:00am and 3:16am Monday, October 31, 2016 (UTC)

 [ [ "2016-10-31T03:06:12.000Z", "0.041500" ], [ "2016-10-31T03:00:26.000Z", "0.041600" ], [ "2016-10-31T02:59:14.000Z", "0.041500" ], [ "2016-10-31T02:00:18.000Z", "0.040600" ], [ "2016-10-30T23:55:06.000Z", "0.043200" ] ] 
+1
Oct 31 '16 at 3:28
source share

If you use golang, I wrote a library that can query data using " https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/ {offer_code} / current / index. {Format } "Format.

https://github.com/Chronojam/aws-pricing-api

 import ( "github.com/chronojam/aws-pricing-api/types/schema" ) func main() { ec2 := &schema.AmazonEC2{} // Populate this object with new pricing data err := ec2.Refresh() if err != nil { panic(err) } // Get the price of all c4.Large instances, // running linux, on shared tenancy c4Large := []*schema.AmazonEC2_Product{} for _, p := range ec2.Products { if p.Attributes.InstanceType == "c4.large" && p.Attributes.OperatingSystem == "Linux" && p.Attributes.Tenancy == "Shared" { c4Large = append(c4Large, p) } } } 
+1
May 15 '17 at 14:53
source share

I am the author of an open source tool called ec2-cost-calculate, which will "report usage of an EC2 instance on an hourly basis" - this tool is available on awsmissingtools.com. The output can be hourly, daily, monthly. There are two versions of the tool, one in Ruby and the other in bash format.

0
Aug 13 2018-12-12T00:
source share

Since Amazon recently changed the pricing scheme for instances of EC2 (no more than Medium or Light, only Heavy, which has several payment options - allUpfront, partialUpfront, noUpfront), and also separated old-generation instances from current ones some time ago, the list of non-documentation API reference links has changed as well as the JSON structure provided by these links. A complete list, if the EC2 censored policies API links with descriptions, as well as the Python module for easy access and structured pricing in JSON, CSV or Table formats can be found in the following repository:

https://github.com/ilia-semenov/awspricingfull

0
Mar 31 '15 at 16:34
source share

If you use Go, I wrote a package for decoding data in a struct, based on files related to @okrasz answer

https://github.com/recursionpharma/ec2prices

Feel free to enter additional pricing data.

0
May 21 '15 at 16:51
source share



All Articles