A scaling group is a collection of Elastic Compute Service (ECS) instances or elastic container instances that can be used in similar business scenarios. If you run your container applications on elastic container instances, you can activate Auto Scaling to automatically scale the number of elastic container instances based on your business requirements. This ensures smooth service delivery and maximizes cost efficiency.
Procedure
Before you proceed, choose which method you want to use to create the scaling group. Alibaba Cloud provides multiple methods to create a scaling group. You can follow the instructions provided in this topic based on your specific business requirements.
If you have an existing elastic container instance and want to create a scaling group based on the configurations of the instance, you can refer to the following link: Method 1: Create a scaling group based on the configurations of an existing instance
If you need to quickly create a scaling group and want to configure the instance configuration source within the group later, you can refer to the following link: Method 2: Create a scaling group from scratch
If you want to create and manage a scaling group by using a Kubernetes YAML file, you can refer to the following link: Method 3: Create a scaling group by using a Kubernetes YAML file
Method 1: Create a scaling group based on the configurations of an existing instance
Method 2: Create a scaling group from scratch
Method 3: Create a scaling group by using a Kubernetes YAML file
Parameters
Basic parameters for creating a scaling group
Parameter | Description |
Scaling Group Name | The name of a scaling group must be 2 to 64 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter or a digit. |
Type | The type of instances that provide computing power in the scaling group. The type of instances that Auto Scaling adds to or removes from the scaling group during a scaling event also matches the value of the Type parameter. Valid values:
|
Instance Configuration Source | The instance configuration source. Auto Scaling creates ECS instances in the scaling group based on the specified source. Valid values:
Note If you create a scaling group based on an existing ECS instance created in the ECS console, Auto Scaling automatically fills the instance configuration source and network type of the scaling group. We recommend that you retain the settings. |
Suspend Process | You can suspend processes before you perform specific operations. For example, you can suspend the health check process before you stop an instance. This way, if the health check fails, the instance is not removed from the scaling group. You can suspend the following processes in a scaling group:
For more information, see Suspend and resume scaling group processes. |
Deletion Protection | After you enable this feature, you cannot delete the scaling group in the Auto Scaling console or by calling an API operation. This helps prevent scaling groups from being accidentally deleted. |
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 lifespan of each instance in the scaling group. When the lifespan of an instance in the scaling group exceeds the value of this parameter, Auto Scaling automatically creates a new instance to replace the instance. Note This parameter is available only if you set the Type parameter to ECS. |
Parameters for configuring instance numbers
Parameter | Description |
Minimum Number of Instances | The lower limit of the number of instances in the scaling group. If the actual number of instances drops below the lower limit, Auto Scaling automatically adds instances to the scaling group until the actual number reaches the lower limit. |
Maximum Number of Instances | The upper limit of the number of instances in the scaling group. If the actual number of instances exceeds the upper limit, Auto Scaling automatically removes instances from the scaling group until the actual number equals to the upper limit. For information about scale-in policies, see Combine scaling policies and scale-in policies. |
Expected Number of Instances | The desired number of instances in the scaling group. If you enable this feature, Auto Scaling automatically ensures that the actual number of instances in the scaling group equals the desired number. For more information, see Expected number of instances. |
Parameters for triggering scale-out or scale-in events
If your scaling group is of the Elastic Container Instance type, you cannot modify the default settings of the following parameters: Scaling Policy, Scale-In Policy, and Instance Reclaim Mode. Default values of the parameters:
Scaling Policy: Cost Optimization Policy
Scale-In Policy: Instances Created From Earliest Scaling Configuration as the first scale-in step and Earliest Instances as the second scale-in step
Instance Reclaim Mode: Release
Parameter | Description |
Scaling Policy | By default, Auto Scaling triggers scaling events in a scaling group based on the specified order (priority policy) of vSwitches. You can set the Scaling Policy parameter to other policies based on your business requirements. Important You can configure the Scaling Policy parameter only for scaling groups whose Type parameter is set to ECS and Network Type parameter is set to VPC. If your scaling group is of the ECI type, only the priority policy is supported.
For information about the custom combination policy, see Configure a scaling policy. |
Scale-In Policy | When a scale-in request is triggered, Auto Scaling removes instances from the scaling group based on the steps defined in the scale-in policy. This parameter is displayed only if you set the Type parameter to ECS. Valid values:
If more than one instance meets the scale-in requirements when you set the Scale-In Policy parameter to Instances Created From Earliest Scaling Configuration or Custom Policy, you can proceed to configure the Then Remove parameter. Valid values of the Then Remove parameter:
Note The value of the Scaling Policy parameter also affects the manner in which instances are removed from scaling groups. For more information, see Combine scaling policies and scale-in policies. |
Instance Reclaim Mode | After an instance is removed from the scaling group, Auto Scaling reclaims the instance based on the value of this parameter. Valid values: Note This parameter is available only if you set the Type parameter to ECS and the Network Type parameter to VPC. By default, elastic container instances are released after they are removed from scaling groups.
|
Parameters for configuring a network
When you set the Instance Configuration Source parameter to Launch Templates or Select Existing Instance, the following parameters are automatically filled based on the selected launch template or existing instance: Network Type, VPC, and vSwitch. You can also reconfigure these parameters based on your business requirements.
Parameter | Description |
Network Type | Specify the network type for the scaling group that you want to create. Valid values: VPC and Classic Network. Warning After you create the scaling group, you cannot change the value of the Network Type parameter. Important We recommend that you select VPC. Scaling groups that reside in VPCs support more flexible scaling policies, instance reclaim modes, and load balancing mechanisms. For more information about VPCs, see What is a VPC? |
VPC | This parameter is displayed only if you set the Network Type parameter to VPC. After you select a VPC from the VPC drop-down list, all ECS instances in this scaling group reside in the VPC. Warning After you create the scaling group, you cannot change the value of the VPC parameter. |
vSwitch | After you select a VPC for the scaling group, you must select one or more vSwitches of the VPC for the scaling group. All ECS instances in the scaling group communicate with each other by using the selected vSwitches. Important We recommend that you select multiple vSwitches. If you select only one vSwitch, scale-out failures caused by insufficient resources in a single zone may often occur. If you select multiple vSwitches, you can set the Scaling Policy parameter to Balanced Distribution Policy to manage the distribution of ECS instances across multiple zones. |
Parameters for associating a scaling group with other cloud services
Parameter | Description |
Associate with ApsaraDB RDS, Redis, or MongoDB | If ECS instances in the scaling group need to access a database such as ApsaraDB RDS, Redis, or MongoDB, you can associate the scaling group with the database by configuring this parameter. You can select one of the following association modes based on the type of the database that you want to use: IP Whitelist Mode and Security Group Mode. Note
|
Associate CLB Instance | After you associate a CLB instance with a scaling group, Auto Scaling adds the instances in the scaling group to the backend server groups of the CLB instance as backend servers. Then, the CLB instance forwards requests to the backend servers. The following types of server groups are supported:
If you specify the default server group and multiple vServer groups at the same time, the instances are added to all the specified server groups. Note An upper limit is imposed on the number of CLB instances and server groups that you can associate with a scaling group. To view the quota or request a quota increase, go to Quota Center. |
Associate ALB and NLB Server Groups | Important This parameter is available only if you set the Network Type parameter to VPC. After you associate an ALB or NLB server group with a scaling group, Auto Scaling adds instances in the scaling group to the ALB or NLB server group as backend servers. Then, the ALB or NLB instance forwards requests to the backend servers. You must specify the port number and weight for each backend server. By default, the weight of a backend server is 50. If you increase the weight of a server, the number of requests that are forwarded to the server increases. If you set the weight of a backend server to 0, no requests are forwarded to the server. If you associate multiple ALB or NLB server groups with the same scaling group, Auto Scaling adds instances in the scaling group to all the ALB or NLB server groups at the same time. Note An upper limit is imposed on the number of ALB or NLB server groups that you can associate with a scaling group. To view the quota or request a quota increase, go to Quota Center. |
Other parameters
Parameter | Description |
Tag | You can add tags to scaling groups for easy search and aggregation. For more information, see Tags. Note The tags apply only to the scaling group. If you want to add tags to an instance in the scaling group, configure the tags in the scaling configuration or the launch template based on which the instance is created. |
Tags Propagated to Instances During Scale-out | After you add one or more tags to the scaling group, you can continue to specify whether to propagate the tags to instances in the scaling group during scale-out events. |
Add Existing Instance | This parameter is available only if you set the Type parameter to ECS and set the Instance Configuration Source parameter to Launch Templates or Select Existing Instance. If you configure the Expected Number of Instances and Add Existing Instance parameters at the same time, the value of the Expected Number of Instances parameter automatically increases. For example, if you set the Expected Number of Instances parameter to 1 and select two existing ECS instances from the Add Existing Instance drop-down list when you create the scaling group, the value of the Expected Number of Instances parameter automatically increases from 1 to 3. If you want to use the scaling group to manage the instance lifecycles, you can select Enable the scaling group to manage the instance lifecycle.
Note You can add subscription instances to the scaling group, but you cannot enable the scaling group to manage the lifecycles of the subscription instances. |
Create Regular Rule | When a scaling event succeeds, fails, or is rejected, Auto Scaling notifies you by text message, internal message, or email based on the rule you set. For more information, see Create a regular notification rule. |
Resource Group | You can add scaling groups to resource groups. Then, you can manage scaling groups 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. After you enable this feature, Alibaba Cloud creates and associates a CloudMonitor application group with the scaling group. The alert rules of the scaling group are synced and displayed in the CloudMonitor console. |
YAML fields
Supported Kubernetes YAML fields
When you use a Kubernetes Deployment to deploy a scaling group of the Elastic Container Instance type, you can configure only the following YAML fields:
A YAML file typically consists of the kind
, metadata
, and spec
fields. For more information about the YAML file structure, see sample Deployment on the Kubernetes official website.
Extended annotations
When you use a Kubernetes Deployment file in the YAML format to deploy a scaling group of the Elastic Container Instance type, you can extend only specific annotations. The following tables describe the extended annotations.