2

I am using an AWS Autoscaling group that distributes instances across multiple AZs, with spot instance bidding defined.

What will happen when the spot price jumps in one of the AZ, causing the instances in that AZ to be below the SPOT price and terminate?

Does the autoscaling group attempt to balance the instances evenly across AZs? Will it wait until the price will match again in that AZ?

I can't find any documentation on that.

womble
  • 96,255
  • 29
  • 175
  • 230
Ofer Velich
  • 307
  • 1
  • 2
  • 6
  • That is actually a very interesting question! If it's not in the documentation, I would suggest to create a support ticket for this since it's definitely a valid question. – Bazze Oct 16 '15 at 05:36

2 Answers2

0

AutoScaling will always try to keep high availability. The main way it does this is by keeping instances evenly distributed throughout the AZs (availability Zones). However, if it can't launch a given instance type in an AZ it will failover to another AZ (be that from spot price/availability, an outage, or just a lack of on demand availability). After it gets up to the desired capacity, it will periodically try to launch a new instance in the underused AZ to re balance the group. https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-benefits.html#AutoScalingBehavior.InstanceUsage

If you use an ASG with multiple instance types and purchase options then it will first figure out if it should be launching a spot or on demand instance based on your settings. Then it will try and launch one of the instance types you selected based on your allocation strategy. If the prefered instance type isn't available, it will try all the instance types in that AZ. If none are available in that AZ it will keep trying other AZs. This way there would have to be quite a few different capacity pools that all couldn't launch instances for you to not get an instance.

It will NOT failover from spot to OnDemand if there is no spot capacity in all of your AZs for any of the instance types you selected.

https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html

Shahad
  • 326
  • 1
  • 6
0

In my experience, the autoscaling group always tries to run the same number of instances in every availability zone that it's using. I've mistakenly added availability zones that don't have any instances of the type specified in the launch configuration, and the ASG kept trying to launch instances there regardless without launching proportionally more instances elsewhere.