autoscalingspot-instances

What happens if a spot instance isn't available for an AWS autoscaling group?


If I have an autoscaling group that consists of on-demand and spot instances with a minimum of 4 on-demand instances, and the extra capacity consisting of spot instances, what happens if it needs to scale up with a spot instance, and there isn't an available spot instance (because I've been outbid, or if there aren't any spare instances to fulfil the spot request)?

Other info:

My Google foo seems to be failing me as I can't seem to find any answers on the web. I would appreciate if anybody could shed some light on this issue.

Thanks in advance!


Solution

  • An AutoScaling Group in AWS will not failover to on demand if there's no spot capacity. This is essentially the trade off your getting for the lower price of spot instances. To work around this, try adding more AZs and/or instance types (not as much of an issue now that weights are supported and ALB can route based on Least Outstanding Requests)

    If you have multiple instance types and AZs setup in the ASG, this happens after your on demand base is met:

    1) Tries to launch the spot instance(s) based on your allocation strategy and number of spot pools

    2) If the desired instance type(s) aren't available, try all the other types in that AZ

    3) If no spot instances are available in that AZ, that launch request will fail and it will try again in another enabled AZ

    4) If there are no spot instances, in any of the types you have selected, in any of the AZs you have on the ASG, then nothing will launch and the ASG will periodically retry until it reaches the desired capacity.

    Think of it like this, there's only so many servers in their data centers. If spot evictions are happening because they need capacity for on demand instances, and everyone running spot failed over to ondemand for that instance type; there would probably suddenly also be an on demand instance capacity issue in that AZ.