I'm looking for the most efficient way to get pricing data for all AWS EC2 instance types programmatically. Specifically, I'm interested in both on-demand and spot pricing across all regions. Is it best to use the AWS Pricing API, make AWS CLI or SDK calls, or is there another recommended approach?
2 Answers
I personally use the instances.vantage.sh UI, and they also offer a free API. It’s user-friendly and summarizes the data quite well.
You should definitely check out the AWS Price List Bulk API. It's great for getting all on-demand pricing in one go. For spot pricing, however, you'll need to query the EC2 API for each region since the pricing isn't available through the Pricing APIs.
That's a good point! Spot prices can change frequently, so it's better to retrieve them dynamically rather than store them.

I've heard that site is useful! There's even a massive JSON file available with all the data if you want to dive deeper into the specifics.