DEV Community

loading...
Cover image for Which AWS Regions Have Spot Instances? Type, Cost, Zone, Interrupt Rate & Region Availability Report.
AWS Community Builders

Which AWS Regions Have Spot Instances? Type, Cost, Zone, Interrupt Rate & Region Availability Report.

Harinder Seera πŸ‡­πŸ‡²
I assist businesses in optimizing their applications for performance. Author of "Introduction To Blockchain" and co-author of IBM Read Book. Also on Blockchain Advisory Board of GSDC.
・Updated on ・2 min read

AWS offers several alternatives for selecting an EC2 Instance. You can choose between On-Demand, Reserved, and Spot. This post focuses mainly on the spot instance. A spot instance takes advantage of unused EC2 capacity at a lower price than the On-Demand fee.

So, how can you determine the current cost of a spot instance? Also, in which region and availability zone are spot instances available? And what about interrupt rate? You don't want to browse the AWS spot instance price page every time this information is needed or updated.

To assist in answering these and other questions, I developed a Python script. I hope it might help others as well. It can assist you in answering some of the questions listed below.

Which AvailabilityZone Has What Spot Instance Type?

Alt Text

What is the Spot Instance Type Cost In The AvailabilityZone?

Alt Text

Instance Types And Product Description

For a particular instance type, how many availability zones contain the following product descriptions.

  • Linux/UNIX
  • Windows
  • Linux/UNIX (Amazon VPC)
  • Windows (Amazon VPC) Alt Text

Availability Zone And Product Description

For a particular availability zone, how many instant types contain the following product descriptions.

  • Linux/UNIX
  • Windows
  • Linux/UNIX (Amazon VPC)
  • Windows (Amazon VPC) Alt Text

Price By Availability Zone, Instance Type And Region

Display spot pricing by instance type, availability zone and region.
Alt Text

Interrupt Rate By Region, Instance Type And OS

Display interrupt rate by region, availability zone and OS.
Alt Text

Download the script from github. For testing purpose, the script only queries spot information for the instance types "t3a.small", "t3a.2xlarge", "c5a.large" and "m4.xlarge". Replace them with your instance types, or you can get spot data for all instance types. To obtain information for all instance types, uncomment the code in the script.

The script not only generates the visualization but also saves the data to a CSV file. CSV data can be analyzed further using various visualization tools. The script can be enhanced to save the data in a database instead of CSV.

If you have any recommendations for how to enhance this script further, please contact me or leave a comment in the comments section.


Thanks for reading!

If you enjoyed this article feel free to share it on social media πŸ™‚

Say Hello on: Linkedin | Twitter | Polywork

Blogging: Dev | Hashnode

Github: hseera

Discussion (0)