A scaling group is a collection of instances, such as Elastic Compute Service (ECS) or Elastic Container Instance (ECI) instances, for a specific application scenario. This topic describes how to create an ECS scaling group to automatically add or remove ECS instances based on your business needs and policies.
Procedure
Before you begin, decide how you want to create the scaling group. Alibaba Cloud provides multiple methods to create a scaling group. You can use the following instructions to quickly create a scaling group based on your requirements.
If you have an existing Launch Template, you can directly create a scaling group using the Launch Template. For more information, see Method 1: Create a scaling group using a launch template.
If you have an existing ECS instance, you can create a scaling group based on the configuration of the instance. For more information, see Method 2: Create a scaling group based on the configuration of an existing ECS instance.
If you want to configure an instance configuration source after you create a scaling group, you can create a scaling group from scratch. For more information, see Method 3: Create a scaling group from scratch.
Parameter description
Basic information
Parameter | Description |
Scaling Group Name | The name must be 2 to 64 characters in length. It must start with a letter, digit, or Chinese character. It can contain periods (.), underscores (_), and hyphens (-). |
Type | The type of instances that provide computing power in the scaling group. Auto Scaling scales instances of the specified type.
|
Instance Configuration Source | Auto Scaling uses this configuration to create instances. The following types of instance configuration sources are supported:
Note When you create a scaling group from an existing instance in the ECS console, Auto Scaling automatically populates the instance configuration source and network type. You do not need to change these settings. |
Suspend Process | You can suspend specified processes before you perform certain operations. For example, you can suspend the health check process before you stop an instance to prevent the instance from being marked as unhealthy and automatically removed from the scaling group. The following processes can be suspended:
For more information, see Suspend and resume scaling group processes. |
Deletion Protection | If you enable deletion protection, you cannot delete the scaling group in the Auto Scaling console or by calling an API operation. This prevents accidental deletion of the scaling group. |
Instance Health Check | After you enable this feature, Auto Scaling checks the status of instances on a regular basis. If Auto Scaling detects that an instance does not run as expected, Auto Scaling considers the instance unhealthy and removes the instance from the scaling group. For more information, see Instance lifecycles. Valid values:
|
Maximum Life Span of Instance (Seconds) | The maximum amount of time that an instance can remain in the scaling group. If an instance in the scaling group exceeds the maximum lifetime, Auto Scaling automatically creates a new instance to replace it. Note This parameter is available only when Scaling Group Type is set to ECS. |
Instance count configuration
Parameter | Description |
Minimum Number of Instances | If the number of instances falls below this limit, Auto Scaling automatically adds instances until the number of instances in the scaling group equals the limit. |
Maximum Number of Instances | If the number of instances in the scaling group exceeds the upper limit, Auto Scaling automatically removes instances from the scaling group until the number of instances is equal to the upper limit. For more information about the instance termination policy, see Set an instance termination policy for a scaling group. |
Expected Number of Instances | If you specify an expected number of instances, Auto Scaling automatically maintains that number of instances in the scaling group. For more information, see Expected number of instances. |
Scaling settings for instances in the group
You cannot modify the Scaling Policy, Scale-In Policy, or Instance Reclaim Mode for ECI scaling groups. The default configurations are as follows:
Scaling Policy: Priority Policy.
Scale-In Policy: Removes instances from the Earliest Scaling Configuration. Among them, the Earliest Instances are removed first.
Instance Reclaim Mode is set to Release.
Parameter | Description |
Scaling Policy | By default, a scaling group scales instances based on the order of the vSwitches that you configure. This is the priority policy. You can change the Scaling Policy to implement other policies. The preset scaling policies provided by Auto Scaling are described below. Important You can modify this configuration only when the Scaling Group Type is ECS and the Network Type is Virtual Private Cloud. If the Scaling Group Type is ECI, the default Scaling Policy is the Priority Policy.
For information about how to configure a scaling policy, see Configure a scaling policy. |
Scale-In Policy | When instances need to be removed from the scaling group, they are first filtered based on the policy. If multiple instances still meet the criteria after filtering, one is randomly removed. This configuration is available only when Scaling Group Type is set to ECS. The following options are available:
If Scale-In Policy is set to Instances Created From Earliest Scaling Configuration or Custom Policy, multiple instances may meet the criteria. You can set a second-level policy to further filter the instances to be removed. The following second-level policies are available:
Note The removal of instances from a scaling group is also affected by its Scaling Policy. For more information, see Configure an instance termination policy for a scaling group. |
Instance Reclaim Mode | After an instance is removed, the scaling group reclaims it based on this configuration. The following reclaim modes are available:
|
Network configuration
When Instance Configuration Source is set to Launch Templates or Select Existing Instance, settings such as Network Type, VPC, and vSwitch are automatically populated from the selected source. You can also modify the network settings for the scaling group.
Parameter | Description |
VPC | All instances in your scaling group are created in that VPC. Warning You cannot change the VPC after the scaling group is created. |
vSwitch | After you select a VPC, you can select vSwitches within that VPC. All instances in your scaling group are created in the selected vSwitches. Important Select vSwitches in multiple zones. If a single zone has insufficient inventory, scale-out activities may fail. If you are using an ECS scaling group, you can also change the Scaling Policy to control the distribution of instances across different zones. |
Associate with other Alibaba Cloud services
Parameter | Description |
Associate with ApsaraDB RDS, Redis, or MongoDB | If instances in your scaling group need to access RDS, Redis, or MongoDB databases, you may need to automatically add the internal IP addresses of the ECS or ECI instances to the whitelist of the database instance. You can use this parameter to do this. Note
|
Associate CLB Instance | After a scaling group is associated with a CLB instance, instances that are added to the scaling group are automatically added as backend servers to the CLB instance to process forwarded requests. You can specify the server group to which instances are added. The following two types of server groups are supported:
If you specify a default server group and multiple vServer groups, instances are added to all of these server groups at the same time. Note You can associate only a limited number of CLB instances and vServer groups with a scaling group. To view your quota or request a quota increase, go to Quota Center. |
Associate ALB and NLB Server Groups | After a scaling group is associated with ALB or NLB server groups, instances that are added to the scaling group are automatically added as backend servers to the ALB or NLB server groups to process requests distributed by the ALB or NLB instances. You must also specify the port and weight for the backend servers. The default weight is 50. The higher the weight, the more access requests an instance receives. If the weight is 0, the instance does not receive any access requests. If you associate a scaling group with multiple ALB or NLB server groups, instances that are added to the scaling group are added to all of these server groups at the same time. Note You can associate only a limited number of ALB or NLB server groups with a scaling group. To view the quota or request a quota increase, go to Quota Center. |
Other configurations
Parameter | Description |
Tag | You can add tags to scaling groups for easy searching and aggregation. For more information, see Tags. Note These tags apply to the scaling group. To add tags to instances within the scaling group, you must set the tags in the scaling configuration or launch template. |
Tags Propagated to Instances During Scale-out | After you add one or more tags to the scaling group, you can select one or more tags to propagate to the instances within the scaling group during a scale-out activity. |
Add Existing Instance | This parameter is available only if Type is set to ECS and Instance Configuration Source is set to Launch Templates or Select Existing Instance. If you set the expected number of instances and add existing instances at the same time, the expected number of instances automatically increases. For example, if you set the expected number of instances to 1 and add two existing instances when you create a scaling group, the two existing instances are added to the scaling group after it is created, and the expected number of instances changes to 3. To transfer the lifecycle management of existing instances to the scaling group, select the Enable the scaling group to manage the instance lifecycle check box.
Note You can add subscription instances to a scaling group, but you cannot entrust their lifecycle management to the scaling group. |
Create Regular Rule | When a scaling activity succeeds, fails, or is rejected, Auto Scaling sends notifications using text messages, internal messages, or emails. For more information, see Configure message notifications. |
Resource Group | You can add scaling groups to resource groups to manage them by resource group. This facilitates resource isolation and permission control. For more information, see Use resource groups to manage scaling groups in a fine-grained manner. |
Synchronize Alert Rule to CloudMonitor | You can enable or disable this feature only when you create a scaling group. If you enable this feature, the system creates a CloudMonitor application group and associates it with the scaling group. The alert rules of the scaling group are then synchronized to the CloudMonitor console. |