Ensure that your Amazon Auto Scaling Groups (ASGs) are configured with the Capacity Rebalancing feature in order to monitor and automatically respond to changes that affect the availability of the Amazon EC2 Spot Instances running within your ASGs. Capacity Rebalancing helps you maintain application availability by proactively augmenting your ASG fleet with a new Spot Instance before a running instance is interrupted by AWS.
Amazon EC2 Auto Scaling is always aware of EC2 instance rebalance recommendation notifications. The cloud service emits these notifications when Spot Instances are at elevated risk of interruption. When the Capacity Rebalancing feature is enabled for your Auto Scaling group (ASG), Amazon EC2 attempts to proactively replace Spot Instances that have received a rebalance recommendation notification, providing the opportunity to rebalance your workload to new Spot Instances that are not at elevated risk of interruption. This means that your application can continue to process the requests while Amazon EC2 Auto Scaling launches a new Spot Instance before an existing instance is interrupted.
Audit
To determine if Capacity Rebalancing is enabled for your Auto Scaling Groups (ASGs), perform the following operations:
Remediation / Resolution
When Capacity Rebalancing is enabled and a rebalance notification is sent to an EC2 instance, the Auto Scaling Group automatically attempts to replace the instance before it is interrupted. To enable the Capacity Rebalancing feature for existing Amazon Auto Scaling Groups (ASGs), perform the following actions:
References
- AWS Documentation
- Auto Scaling groups
- Use Capacity Rebalancing to handle Amazon EC2 Spot interruptions
- EC2 instance rebalance recommendations
- AWS Command Line Interface (CLI) Documentation
- autoscaling
- describe-auto-scaling-groups
- update-auto-scaling-group