If your ECS instances are unevenly distributed across zones, for example, due to insufficient inventory, you can rebalance them to restore an even distribution. This topic describes how to rebalance your ECS instances.
Prerequisites
-
The scaling group is in the Enable state.
-
The network type of the scaling group is VPC.
-
The scaling group's Distribution Balancing is set to Distribution Balancing.
-
The scaling group is associated with multiple vSwitches and spans at least two zones.
Considerations
-
Rebalancing is necessary only when the instances in your scaling group are severely imbalanced. A single rebalance operation can replace a maximum of 20 ECS instances.
-
During a rebalance operation, Auto Scaling first creates new ECS instances and then terminates and releases existing ones to balance the distribution across zones. This process does not affect the performance or availability of your application.
-
During a rebalance, if a scaling group is near its maximum instance count, Auto Scaling allows the instance count to temporarily exceed the maximum by up to 10% to complete the operation. This temporary state typically lasts for 1 to 6 minutes until the instance distribution is balanced.
NoteIf 10% of the maximum instance count is not a whole number, the number of allowed extra instances is rounded up. For example, if the maximum instance count is 15, 10% is 1.5. In this case, Auto Scaling allows the number of instances to temporarily exceed the maximum by 2.
Steps
Log on to the Auto Scaling console.
In the navigation pane on the left, click Scaling Groups.
In the top navigation bar, select a region.
Find the scaling group that you want to manage and open its details page in one of the following ways:
In the Scaling Group Name/ID column, click the ID of the scaling group.
In the Actions column, click Details.
At the top of the page, click the Instance Management tab.
-
On the Auto Created tab, click Rebalance Distribution.
-
In the Rebalance the Distribution of ECS Instances in a Scaling Group Across Multiple Zones dialog box, review the information and click Submit.
Results
After the rebalance task starts, the newly created ECS instances appear in the instance list. Shortly after, the new ECS instances enter the In Service state and some original instances are released. The total number of ECS instances in the scaling group remains unchanged.