Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
Bob is a senior IT in charge of a mid-sized manufacturing company, having its operations in 10 countries, and factories in 2 countries.
The company decided two years back to migrate 80% of its IT infrastructure to AWS. As Bob led this activity, he was the go-to-guy for the finance dept., for verifying the bills.
For few months, Bob managed the verification of bills and budget planning, by going through AWS website and scrubbing pricing data, through his own eyes and mind.
But, Bob was a certified smart guy. So, he decided to automate it.
How? Letâs hear from Bob.
Me: Hey Bob, How you doing?
Bob: (smiles, coz he got who I sounded like) cool man, thanks.
Me: Bob, you used the AWS pricing APIs. What compelled you to do so?
Bob: The time taken to go through the AWS site, for pricing details.
We use 100s of EC2s of different flavours, of different sizes, TBs of different types of storages, databases, etc. And thatâs just a small part of huge offerings by AWS.
Manually going through the prices, noting it at a particular date, keep looking for changes was too much. So, decided to do something about it.
By integrating the AWS APIs, now we have a dashboard tailored to our needs, and is always up-to-date. We have also created our own customized calculator for our users. It integrates the AWS prices and that from local vendors.
This has helped in streamlining our consumption and price is now more predictable.
Me: This makes sense for somebody like you, who deals with these many AWS components day-in-day-out, and is accountable for the expense.
Bob: Yes that true.
Me: I went through the API documentation of AWS Pricing. Let me summarize what I have understood, and ask you my doubts.
Bob: Sure
Me: First, the basics:
- The API access is through https.
- AWS provides the pricing information as json or csv.
- The APIs are publicly accessible, without AWSÂ account.
- The base address for accessing json/csv is https://pricing.us-east-1.amazonaws.com/
- us-east-1 in above url is where all information is available and is not limited only to this zone.
To access the data, I followed these steps
Step1: Got the list of offerings from AWS by downloading
https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/index.json.
It has details of all AWS products and information of where to get its prices from.
For eg.
âAmazonEC2â: { âofferCodeâ : âAmazonEC2â, âversionIndexUrlâ : â/offers/v1.0/aws/AmazonEC2/index.jsonâ, âcurrentVersionUrlâ: â/offers/v1.0/aws/AmazonEC2/current/index.jsonâ, âcurrentRegionIndexUrlâ: â/offers/v1.0/aws/AmazonEC2/current/region_index.jsonâ },
(Note: A product, like AmazonEC2, is referred as âOfferâ)
Step2: From the above set, accessed the âcurrentRegionIndexUrlâ url â
https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/region_index.json
It gave details of prices in each region.
For eg.
"ap-south-1" :{"regionCode" : "ap-south-1","currentVersionUrl":"/offers/v1.0/aws/AmazonEC2/20180628005902/ap-south-1/index.json"},
Now, the things are getting murkier. Itâs a sea of confusing data.
There are some cryptic codes involved, and I couldnât find any AWS document explaining these codes. Also, some sections show price as 0.0 dollars. Howâs that possible?
Bob: The summary till now is correct. You have reached the source of data, but you are struggling to extract information out of it. To do that, you have to understand the offerings, and find patterns.
For example, you are accessing EC2 pricing. Now, EC2 pricing has variations like on-demand, dedicated hosts, reserved hosts. Then again, variations like full/no/partial upfront payment, etc.
Such variations are captured through those alien-looking codes.
Letâs take an example:
We want to check the price of Linux m5.large with SQL Enterprise preinstalled.
Through parsing, you get the code of this variantâââZV5VAXGR4YZS96VY
Search with this code and you will get multiple blocks in the file.
Each block represents a unique variant of the same productâââthe varying factors are mentioned above, like payment terms, dedicated hosts, etc
Each block will have a unique identifier, âOffertermcodeâ. For eg., âJRTCKXETXFâ represents on-demand pricing, payable per hr.
Another example, âHU7G6KETJZâ represents reserved pricing with partial upfront fees. So the billing will include some amount to be paid upfront and some per month. â2TG2D8R56Uâ is for upfront & â6YS6EN2CT7â is for per/hr.
Thatâs it.
To summarize, there are three level of depths.
- Unique code of EC2âââsay ZV5VAXGR4YZS96VY
- Unique offertermcode of above variant âOn-demand, fully-upfront-paid, no-upfront-paid, etc â~13 unique offertermcode
- Upfront and/or Per-hr payment terms
Me: Thanks Bob. Itâs clear and demystified now.
I really want to be like you.
AWS Price API documentation can be accessed here.
This post was originally posted here.
Please provide your feedback in the comment section. It will help me improve. You can also email me at dhruvdesaai@gmail.com.
Demystifying AWS Pricing APIs & its Cryptic codes was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.
Disclaimer
The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.