Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any API's for Amazon Web Services PRICING? [closed]

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.

thanks

like image 723
edla Avatar asked Sep 03 '10 14:09

edla


People also ask

Is Amazon API free?

With Amazon API Gateway, you only pay when your APIs are in use. There are no minimum fees or upfront commitments. For HTTP APIs and REST APIs, you pay only for the API calls you receive and the amount of data transferred out.

Does AWS provide APIs?

You can make up to one million API calls for free by signing up at the AWS Portal. AWS AppSync offers fully managed GraphQL API setup, administration, and maintenance, with high-availability serverless infrastructure built-in. You pay only for what you use with no minimum fees or mandatory service usage.

Which AWS service can be utilized at no cost?

Notable Always Free offers include some level of free usage for AWS Lambda, AWS Storage Gateway, Amazon Dynamo DB, Amazon Glacier, Amazon CloudWatch, and many other useful services.

What are the 3 AWS pricing principles?

There are three fundamental drivers of cost with AWS: compute, storage, and outbound data transfer. These characteristics vary somewhat, depending on the AWS product and pricing model you choose.


2 Answers

UPDATE:

AWS has pricing API nowadays: https://aws.amazon.com/blogs/aws/new-aws-price-list-api/

Original answer:

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.

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

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...

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.:

  • http://aws.amazon.com/ec2/pricing/pricing-on-demand-instances.json
  • http://aws.amazon.com/s3/pricing/pricing-storage.json

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' 

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!

like image 112
Blairo Avatar answered Sep 25 '22 22:09

Blairo


For the people who wanted to use the data from the amazon api who uses things like "t1.micro" here is a translation array

type_translation = {     'm1.small' : ['stdODI', 'sm'],     'm1.medium' : ['stdODI', 'med'],     'm1.large' : ['stdODI', 'lg'],     'm1.xlarge' : ['stdODI', 'xl'],     't1.micro' : ['uODI', 'u'],     'm2.xlarge' : ['hiMemODI', 'xl'],     'm2.2xlarge' : ['hiMemODI', 'xxl'],     'm2.4xlarge' : ['hiMemODI', 'xxxxl'],     'c1.medium' : ['hiCPUODI', 'med'],     'c1.xlarge' : ['hiCPUODI', 'xl'],     'cc1.4xlarge' : ['clusterComputeI', 'xxxxl'],     'cc2.8xlarge' : ['clusterComputeI', 'xxxxxxxxl'],     'cg1.4xlarge' : ['clusterGPUI', 'xxxxl'],     'hi1.4xlarge' : ['hiIoODI', 'xxxx1'] } region_translation = {     'us-east-1' : 'us-east',     'us-west-2' : 'us-west-2',     'us-west-1' : 'us-west',     'eu-west-1' : 'eu-ireland',     'ap-southeast-1' : 'apac-sin',     'ap-northeast-1' : 'apac-tokyo',     'sa-east-1' : 'sa-east-1' } 
like image 41
Spidfire Avatar answered Sep 23 '22 22:09

Spidfire