Amazon Web Services – Spot Rules in EC2 Spot Instances
In this article, we are going to walk through a few simple rules to follow when launching Amazon EC2 spot instances. Spot instances enable you to optimize costs on an AWS cloud and scale the throughput of your application up to 10 times for the same budget.
In this article, we will discuss two simple rules to follow when thinking about launching spot instances:
Rule 1:
Spot pools have separate prices and change less frequently. Each instance type, size, and availability zone in every region is a separate spot pool.
For example, take a look at the below image where c3.2xlarge in us-east-1c has a separate price and for c4.8xlarge in us-east-1d has a separate price for c3.2xlarge is $10.9 right now. But it could be $0.9 tomorrow and it adjusts based on long-term supply and demand.

c3.2xlarge on US east 1c

c4.8xlarge on US east 1d
Rule 2:
Amazon EC2 will give you a two-minute warning when AWS needs the capacity back.
You can request spot capacity similar to on-demand and always pay the current spot price. When AWS needs the capacity back, you will get a two-minute warning. AWS sends you the notification about the spot instant status. There are two reasons your spot instance could be marked for termination:
- The current spot price has risen above your maximum willingness to pay.
- The capacity is no longer available to serve your instance.
The bit status of your spot instance request is set to marked for termination and spot termination time metadata is set to a time precisely two minutes in the future.
Example 1: Response you will get when you call describe-spot-instance-requests API for the instance that got marked for termination.
"Status": { "Update Time" : "2022-03-02T18:16:21.000z", "Code" : "marked-for-termination", "Message" : "The Spot Instance is marked for termination", },
Example 2: Response you will get when you call describe-spot-instance-requests API for the instance that got terminated.
"Status": { "Update Time" : "2022-03-02T18:16:21.000z", "Code" : "instance-terminated-capacity-oversubscribed", "Message" : "Your Spot Instance was terminated as there is no more unused capacity available in this pool.", },
AWS EC2 Spot Instances Termination:
When using Amazon EC2 Spot Instances, it is important to be aware that AWS may need the capacity back and will give a two-minute warning before terminating the spot instance. There are two reasons your spot instance may be marked for termination:
- The current spot price has risen above your maximum willingness to pay.
- The capacity is no longer available to serve your instance.
When AWS needs the capacity back, the status of your spot instance request will be set to “marked for termination” and the spot termination time metadata will be set to a time exactly two minutes in the future. If the instance is actually terminated, the status will be updated to “instance-terminated” with a specific message indicating the reason for the termination.
Please Login to comment...