Auto Scaling can quickly provision a computing cluster that contains Elastic Compute Service (ECS) instances that are evenly distributed across multiple zones and monitor the status of the instances in real time to ensure high availability of the cluster. This topic describes how to use Auto Scaling to deploy a high-availability computing cluster that contains ECS instances that are evenly distributed across multiple zones and use preemptible instances to reduce resource costs.
Scenarios
Description
In scenarios such as distributed big data computing and AI training, a large amount of computing power is required during peak hours. In this case, you must quickly provision a high-availability computing cluster to address business demands.
For example, if you operate an online advertising company that utilizes machine learning to effectively deliver advertisements, your company requires substantial computing resources during times of high demand. When you create a computing cluster that contains multiple ECS instances, issues, such as creation failure due to lengthy manual processes and inadequate resources and temporary downtime of ECS instances due to failures in a zone, may occur. The preceding issues may pose risks to your business operations.
Solutions
You can use Auto Scaling to automatically create ECS instances and implement a balanced distribution policy to ensure that the instances are evenly distributed across multiple zones. You can also use preemptible instances to reduce resource costs.
Benefits
If you use Auto Scaling to deploy a high-availability computing cluster, you can obtain the following benefits:
Zero O&M costs
You can use Auto Scaling to automatically change the number of ECS instances without the need for manual intervention.
High availability
The balanced distribution policy of Auto Scaling ensures that ECS instances are evenly distributed across multiple zones, which prevents scaling failures due to insufficient resources in a zone. By default, the instance health check feature is enabled, which ensures that all ECS instances that belong to your scaling group are always available.
Ultra-high cost performance
If you use preemptible instances as compute nodes, you can effectively reduce resource costs.
Procedure
You must evaluate your business modules based on your business architecture and create a scaling group for the business modules that require a high-availability computing cluster.
You must prepare a custom image based on your application. Specify the custom image when you set up a scaling configuration to ensure that the ECS instances created based on the scaling configuration meet your business requirements. For more information, see Create a custom image from an instance.
Log on to the Auto Scaling console.
Create a scaling group.
In the left-side navigation pane, click Scaling Groups.
In the top navigation bar, select the region in which you activated Auto Scaling.
In the upper-left corner of the Scaling Groups page, click Create.
On the Create by Form tab, configure the scaling group and click Create.
The following table describes the parameter settings used in this example. Use the default settings for parameters that are not included in the table. For information about how to create a scaling group, see Create scaling groups.
Parameter
Example
Description
Scaling Group Name
test
Enter a name for the scaling group. The name must follow the format requirements displayed on the UI.
Type
ECS
Select ECS, which specifies that the scaling group contains ECS instances.
Instance Configuration Source
Create from Scratch
Do not specify a template used to automatically create ECS instances. After the scaling group is created, you can proceed to create a scaling configuration.
Minimum Number of Instances
100
Specify the minimum instance limit. If the number of instances in the scaling group is smaller than the value of this parameter, Auto Scaling adds ECS instances to the scaling group until the number of ECS instances in the scaling group reaches the lower limit.
Maximum Number of Instances
120
Specify the maximum instance limit. If the number of instances in the scaling group is greater than the value of this parameter, Auto Scaling removes ECS instances from the scaling group until the number of ECS instances in the scaling group does not exceed the upper limit.
Balanced Distribution Policy
In this example, set this parameter to Balanced Distribution Policy. You must select multiple vSwitches to allow the policy to take effect.
VPC
vpc-2zeghwzptn5zii0w7****
Select a VPC for the ECS instances in the scaling group.
vSwitch
vsw-2ze23nqzig8inprou****
vsw-2zeet2ksvw7f14ryz****
vsw-2ze94pjtfuj9vaymf****
Select one or more vSwitches for the ECS instances in the scaling group.
We recommend that you select multiple vSwitches. This way, the balanced distribution policy can ensure that ECS instances in the scaling group are evenly distributed across multiple zones, which improves the success rate of scale-out operations.
Create a scaling configuration.
On the Scaling Groups page, find the desired scaling group and click its ID.
In the upper part of the scaling group details page, click the Instance Configuration Sources tab.
On the Scaling Configurations tab, click Create Scaling Configuration.
On the Create Scaling Configuration page, configure parameters to complete the process for creating a scaling configuration and click Create.
The following table describes the parameter settings used in this example. Use the default settings for parameters that are not included in the table. For more information about how to create a scaling configuration, see Create a scaling configuration of the ECS type.
Section
Parameter
Example
Description
Basic Information
Scaling Configuration Name
test
Enter a name for the scaling configuration. The name must follow the format requirements displayed on the UI.
Billing Method
Preemptible Instance
You can use Auto Scaling free of charge. However, you are charged for the ECS instances that are created during scale-out events. In this example, set the Billing Method parameter to Preemptible Instance. For more information, see Billing overview.
Instance and Image
Instance Configuration Mode
Specify Instance Pattern
Select Specify Instance Pattern to configure the specifications of ECS instances.
Instance Attribute Combination
2 vCPUs, 4 GiB of Memory, Enterprise Level
Specify the number of vCPUs and the memory size of ECS instances based on your business requirements.
Select Image
test
Select an image to deploy ECS instances.
In actual business scenarios, we recommend that you select the custom image created based on your application.
Storage
System Disk
Enterprise SSD (ESSD), 40 GiB, PL0
Select a system disk for ECS instances. We recommend that you configure parameters in this section based on your business requirements.
Network and Security Group
Security Group
sg-bp18kz60mefsicfg****
Select an existing security group. For information about how to create a security group, see Create a security group.
Management Settings
Logon Credentials
Set Later
Select Set Later, which specifies that you must manually configure passwords for ECS instances after you create the ECS instances.
Follow the on-screen instructions to enable the scaling group and scaling configuration.
Results
If you set the Minimum Number of Instances parameter to 100 when you create the scaling group, Auto Scaling evenly distributes 100 ECS instances across the specified zones to deliver a computing cluster and ensures the high availability of the cluster in the following aspects to reduce resource costs:
When issues occur as a result of insufficient resources in a single zone, Auto Scaling attempts to deploy ECS instances in alternative zones, thereby minimizing the impacts on your business application.
When preemptible instances are reclaimed, Auto Scaling creates new preemptible instances and replaces unhealthy ECS instances with new instances.
What to do next
If ECS instances are unevenly distributed across multiple zones due to insufficient resources, you can rebalance the distribution of the ECS instances across the zones. For more information, see Rebalance the distribution of ECS instances.