DEV Community

Cover image for Being street smart with AWS Spot Instances !!

Being street smart with AWS Spot Instances !!

Well, all of us know that there is AWS Spot Instances available at much lower prices risking consistent availability. But do everyone knows that there is a Spot Placement score which keeps us informed about the likely availability of the instance type, region & AZ of our needs?

Welcome to another key area of cost optimization series !!

What are AWS Spot Instances?
AWS Instance types that EC2 instances that are unused and free. Utilizing AWS Spot Instances is smart choice for jobs or tasks that can be interrupted and/or started on based on EC2 Spot Instance request availability. This gives us great edge for saving costs for workloads that can be risked for interruptions

When to use AWS Spot Instances?
My best tip would be to go in for, "All things non-production" which are "stateless & flexible workloads"

How is AWS Spot Instance available?
Make an AWS Spot Instance Request from the AWS account and once there is free resource/EC2 of the requested EC2 Instance Type & Configuration, then the capacity is released or else request will be made until there is availability

Cost Benefit - AWS Spot Instances !!
AWS Spot Instances are 90% less compared to their on-demand prices.

What to look out for in terms of limitations ?
i) Availability - Raising request doesn't guarantee EC2 availability immediately
ii) If on-demand rises for the instance type which is provisioned as Spot, there will be an interruption notification and rebalance recommendations

Now, that sets the background for anyone on Spot Instances but how to you plan or get best bet on getting it? Use AWS Spot Placement Score

AWS Spot Placement Score
Feature in AWS that helps in selecting the right Region & AZ for placing the Spot Instances request. Basically, Instance Type or vCPU or Memory can be defined and AWS gives a score rating from 1 to 10 against each Region & AZ(optional) where 10 giving more surety on getting a successful spot instance(s) in that Region and/or AZ and 1 being "No or less chances of getting a spot instances"

Let us see how it works. Go to EC2 Console View -> Spot Requests -> Spot Placement Score

Step 1

i) Define the required no. of instances or no of vCPU(s) or amount of memory
ii) In this assessment, I have given '2' instances of type 'c6g.12xlarge'

Image description

Step 2

i) Next, is region and/or AZ selection
ii) Now the score in all the activated region(s) in my account gets a '3' which means the instance type 'c6g.12xlarge' availability on Spot cannot be guaranteed

Image description

Whats Next

Now, I can go with below options
1) Go for some other equivalent instance type and check their placement score. If better, use that EC2 instance type
2) Again, getting good placement score, say 10, doesn't give any assurance of getting the instance type available immediately
3) Score generated needs to be refreshed or 'Load New Placement Score' as & when the discussions more forward
4) Right time to use this 'AWS Spot Instance Placement Score' is just before buying or placing "AWS Spot Instance Request"

Save More !!

Top comments (0)