Amazon EC2-what is the difference between on demand and on spot instances other than pricing that spot is more cheaper than on demand
Asked Answered
P

2

9

i want to the difference between spot and on demand instances. I know there is a price difference between these two but other than this i want to know the differences. Please help me

Photomechanical answered 23/11, 2020 at 9:1 Comment(0)
S
23

Actually there are three allocation types:

  • on demand - kind of "default" mode. You request an instance, if there is free capacity, you will get the instance. No long term commitment, but once you get an instance, it's yours. It may happen that you will get a message that there is no free capacity for the specific instance type and AZ (so far it happened to me only once with AWS).

  • reserved - AWS reserves the capacity for you. You have guarantee that you will get the instance type in the selected region or AZ.

  • spot instance - it's kind of auction / bidding of unused capacity. You ask for an instance, you provide your maximum price and if there is free capacity and your price is at the current price or higher, you will get an instance. The difference is - if the free capacity is exhausted, or the current price is higher than your maximum bid price, your spot instance is terminated . You can get a termination warning event upfront.

Spaniard answered 23/11, 2020 at 9:19 Comment(1)
If the spot instance is terminated, does the ec2 instance stop working until I take action? Do I need to redeploy everything?Lighterage
B
2

The resources for both are the same, spot instances utilise the spare compute capacity within the AWS availability zone (those that are not reserved or launched on-demand).

Depending on the demand for that instance class in the availability zone the spot price will increase or decrease (even surpassing the on-demand price).

When you use a spot instance you are taking a risk that if demand increases you will lose access to the spot instance (you are given a 2 minute warning before termination). For his reason it is common to use a mixture of on-demand/reserved instances and spot instances so that you can withstand instance terminations.

Commonly in EC2 applications you would use an autoscaling group with a configured proportion between on-demand/reserved nodes and spot instances.

For more information take a look at the Requesting Spot Instances for fault-tolerant and flexible applications documentation.

Burnedout answered 23/11, 2020 at 9:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.