Description
Ensure that EC2 Auto Scaling groups using Spot Instances have Capacity Rebalancing enabled, so that Amazon EC2 Auto Scaling proactively launches a replacement Spot Instance when an existing Spot Instance receives a rebalance recommendation, before it is actually interrupted.
Rationale
Spot Instances can be reclaimed by AWS with only a two-minute interruption notice, and without Capacity Rebalancing, an Auto Scaling group only reacts after an instance has already been terminated, resulting in a brief capacity gap and potential impact to application availability. Enabling Capacity Rebalancing allows the group to react to the earlier rebalance recommendation signal and launch a replacement instance in advance, reducing the disruption caused by Spot interruptions.
Impact
Reduces application disruption caused by Spot Instance interruptions
Improves overall availability for workloads using Spot Instances in an Auto Scaling group
May cause temporarily higher instance counts during the rebalancing transition
Default Value
Capacity Rebalancing is disabled by default on Auto Scaling groups, even when Spot Instances are used.
Pre-Requisites
An Auto Scaling group configured with a mixed instances policy or launch template using Spot Instances
IAM permissions to update Auto Scaling group settings (autoscaling:UpdateAutoScalingGroup)
Test Plan
Sign in to the AWS Management Console at https://console.aws.amazon.com.
Navigate to EC2 > Auto Scaling Groups.
Select the Auto Scaling group to review.
Open the Details tab and review the Capacity rebalance attribute under Purchase options and instance types.
Verify that Capacity rebalance shows as On for groups using Spot Instances.
If Capacity rebalance is Off, follow the implementation steps.
Implementation Steps
Sign in to the AWS Management Console at https://console.aws.amazon.com.
Navigate to EC2 > Auto Scaling Groups and select the group to update.
On the Details tab, locate Allocation strategies and select Edit.
Under the Allocation strategies section, select the checkbox to enable Capacity Rebalancing.
Choose Update to save the change.
Verify the Details tab now shows Capacity rebalance as On.
Backout Plan
Sign in to the AWS Management Console at https://console.aws.amazon.com.
Navigate to EC2 > Auto Scaling Groups and select the affected group.
On the Details tab, locate Allocation strategies and select Edit.
Clear the Capacity Rebalancing checkbox.
Choose Update to save the change.
Reference
https://docs.aws.amazon.com/autoscaling/ec2/userguide/capacity-rebalance.html
https://docs.aws.amazon.com/config/latest/developerguide/autoscaling-capacity-rebalancing.html