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?
What is the Spot Instance Type Cost In The AvailabilityZone?
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)
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)
Price By Availability Zone, Instance Type And Region
Display spot pricing by instance type, availability zone and region.
Interrupt Rate By Region, Instance Type And OS
Display interrupt rate by region, availability zone and OS.
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
Github: hseera
Top comments (0)