Profile Applicability
- Level 2
Description
Capacity Rebalancing is a feature in Amazon EC2 Auto Scaling that proactively replaces Spot Instances at risk of interruption. When the Spot service detects that an instance is at elevated risk, it sends a rebalance recommendation. Enabling Capacity Rebalancing ensures that the Auto Scaling group launches replacement instances before the at-risk instances are interrupted, improving workload availability and resilience.
Rationale
Improved Availability: Proactively replaces Spot Instances at risk of interruption, reducing downtime.
Enhanced Fault Tolerance: Ensures workloads remain operational during Spot capacity fluctuations.
Cost Optimization: Maintains desired capacity by leveraging Spot Instances effectively.
Impact
Pros:
Reduces the risk of service disruptions caused by Spot Instance interruptions.
Improves workload resilience and availability.
Automates the replacement of at-risk instances.
Cons:
May increase costs if replacement instances are launched before interruptions occur.
Requires proper configuration of Spot Instances and allocation strategies.
Default Value
By default, Capacity Rebalancing is not enabled for Auto Scaling groups. It must be explicitly configured.
Pre-Requisite
IAM Permissions Required:
autoscaling:UpdateAutoScalingGroup
autoscaling:DescribeAutoScalingGroups
AWS CLI installed and configured.
Remediation
Test Plan:
Using AWS Console:
Sign in to the AWS Management Console.
Navigate to EC2 > Auto Scaling Groups.
Select the Auto Scaling Group to check its configuration.
Under the Details tab, verify if Capacity Rebalancing is enabled.
Using AWS CLI:
Describe the Auto Scaling Group:
aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names <asg-name>
Check the CapacityRebalance field in the output. Ensure it is set to true.
Implementation Steps:
Using AWS Console:
Navigate to EC2 > Auto Scaling Groups.
Select the Auto Scaling Group to update.
Click Edit and enable Capacity Rebalancing under the Instance Management section.
Save the updated configuration.
Using AWS CLI:
Enable Capacity Rebalancing for the Auto Scaling Group:
aws autoscaling update-auto-scaling-group \ --auto-scaling-group-name <asg-name> \ --capacity-rebalance
Verify the updated configuration:
aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names <asg-name>
Backout Plan
Using AWS Console:
If enabling Capacity Rebalancing causes issues, sign in to the AWS Management Console.
Navigate to EC2, then to Auto Scaling Groups.
Select the Auto Scaling Group and go to the Capacity Rebalancing section.
Disable Capacity Rebalancing by unchecking the box.
Save the changes and verify that Capacity Rebalancing is no longer enabled.
Using AWS CLI:
To disable Capacity Rebalancing, run:
aws autoscaling update-auto-scaling-group --auto-scaling-group-name <ASG_NAME> --no-capacity-rebalancing
Verify that Capacity Rebalancing has been disabled:
aws autoscaling describe-auto-scaling-groups --auto-scaling-group-name <ASG_NAME>