Create an ECI scaling group
A scaling group is a collection of instances that share the same application scenarios and instance type (ECS or elastic container instance). When you run container applications on elastic container instances, Auto Scaling can scale the instances based on workload. This maintains service performance and reduces usage costs.
Procedure
Alibaba Cloud provides several methods for creating scaling groups. Review the following options to choose the method that best suits your scenario.
-
If you have an existing elastic container instance and want to create a scaling group based on its configuration, see Method 1: Create a scaling group based on the configuration of an existing elastic container instance.
-
If you want to quickly create a scaling group and configure the instance configuration source later, see Method 2: Create an ECI scaling group from scratch.
-
If you want to create and manage an ECI scaling group by using a Kubernetes YAML file, see Method 3: Create an ECI scaling group by using a Kubernetes YAML file.
Parameters
Basic settings
|
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, and can contain periods (.), underscores (_), and hyphens (-). |
|
Scaling group type |
Specifies the type of instances that provide computing power in the scaling group. Auto Scaling scales out or scales in instances of the specified type based on this setting.
|
|
Instance configuration source |
Auto Scaling creates instances based on this setting. The following instance configuration sources are supported:
Note
When you create a scaling group from an instance in the ECS console, Auto Scaling automatically populates settings such as the instance configuration source and network type. You can keep the default settings. |
|
Suspended Processes |
You can suspend specific 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 removed from the scaling group. The following processes can be suspended:
For more information, see Suspend and resume scaling group processes. |
|
Enable scaling group protection |
If you enable this feature, you cannot delete the scaling group in the Auto Scaling console or by calling an API. This prevents accidental deletion of the scaling group. |
|
Instance health check |
When enabled, the scaling group periodically checks the running status of its instances. If an instance is not in the Running state, the scaling group considers it unhealthy and removes it. For more information, see Lifecycle of instances in a scaling group. The following options are available:
|
|
Maximum instance lifetime (sec) |
The maximum amount of time that an instance can remain in the scaling group. When an instance's lifetime expires, Auto Scaling automatically replaces it with a new one. Note
This parameter is available only when scaling group type is set to ECS. |
Instance count
|
Parameter |
Description |
|
Minimum number of instances |
If the number of instances in the scaling group falls below this minimum, Auto Scaling automatically adds instances to meet this limit. |
|
Maximum number of instances |
If the number of instances in the scaling group exceeds this maximum, Auto Scaling automatically removes instances to meet this limit. For more information about how instances are removed, see Configure a removal policy for a scaling group. |
|
Desired number of instances |
The number of instances that the scaling group attempts to maintain. For more information, see Desired number of instances. |
Instance scaling
For ECI scaling groups, you cannot modify the scaling policy, removal policy, or instance recycle mode. ECI scaling groups use the following default settings:
-
Scaling policy: Priority policy.
-
Removal policy: First, select instances from the oldest scaling configuration, and then remove the oldest instances.
-
Instance recycle mode: Release.
|
Parameter |
Description |
|
Scaling policy |
By default, a scaling group uses the priority policy to perform scaling activities based on the order of the vSwitches that you configure. You can change the Scaling Policy to apply other policies. The scaling group offers several preset scaling policies, which are described as follows. Important
You can change this configuration only when the Type is ECS and the Network Type is VPC. If the Type is ECI, the default Scaling Policy is the Priority.
For configuration instructions, see Configure a scaling policy. |
|
Removal policy |
This policy determines which instances to remove during a scale-in activity. If multiple instances match the criteria, Auto Scaling randomly removes one. This setting is supported only when scaling group type is ECS. The following options are available:
When the removal policy is Oldest scaling configuration or Custom policy, multiple instances may match the criteria. You can set a secondary policy to further refine the selection. The following secondary policies are available:
Note
The removal of instances is also affected by the scaling group's scaling policy. For more information, see Configure a removal policy for a scaling group. |
|
Instance recycle mode |
This mode determines what happens to an instance after it is removed from the scaling group. The following modes are available: Note
This setting is available only when scaling group type is ECS and network type is VPC. For ECI scaling groups, the default mode is Release.
|
Network
When Instance configuration source is Launch template or Select Existing Instance, settings such as network type, VPC, and Select vSwitch are automatically populated based on the template or selected instance. You can reconfigure the network settings for the scaling group as needed.
|
Parameter |
Description |
|
Network type |
The network type for instances in the scaling group. VPC and classic network are supported. Warning
The network type cannot be changed after the scaling group is created. Important
We recommend that you select Virtual Private Cloud (VPC). VPC scaling groups support more flexible configurations, such as more flexible scaling policies, instance recycle modes, and association with Application Load Balancers (ALBs) and Network Load Balancers (NLBs). For more information about VPCs, see What is a Virtual Private Cloud (VPC)?. |
|
VPC |
This setting is available when network type is VPC. All instances in the scaling group are created in the selected VPC. Warning
The VPC cannot be changed after the scaling group is created. |
|
Select vSwitch |
After selecting a VPC, you can select its vSwitches. All instances in the scaling group are created in the selected vSwitches. Important
We recommend selecting vSwitches from multiple availability zones. This prevents scaling failures that can occur if a single zone runs out of stock. For ECS scaling groups, you can also change the scaling policy to control the distribution of instances across availability zones. |
Associated services
|
Parameter |
Description |
|
Associate with RDS, Redis, and MongoDB instances |
If instances in your scaling group need to access RDS, Redis, or MongoDB databases, you can use this setting to automatically add the internal IP addresses of new instances to the IP whitelist of the selected database instances. Note
|
|
Associate with Classic Load Balancer (CLB) |
After associating a scaling group with a CLB instance, instances added to the group are automatically registered as backend servers with the CLB instance to handle forwarded requests. You can specify the server group to which the instances are added. The following types of server groups are supported:
If you specify both a default server group and multiple virtual server groups, instances are added to all of them. Note
A scaling group can be associated with a limited number of CLB instances and virtual server groups. To view or request a quota increase, go to Quota Center. |
|
Associate with ALB/NLB server group |
Important
This setting is available only when network type is VPC. After associating a scaling group with an ALB or NLB server group, instances added to the scaling group are automatically registered as backend servers to handle requests. You must also specify the port and weight for the backend servers. The default weight is 50. A higher weight means the instance receives more requests. If the weight is 0, the instance receives no requests. If you associate a scaling group with multiple ALB or NLB server groups, instances added to the scaling group are registered with all of them. Note
A scaling group can be associated with a limited number of ALB and NLB server groups. To view or request a quota increase, go to Quota Center. |
Other settings
|
Parameter |
Description |
|
Tags |
Add tags to facilitate searching for and grouping scaling groups. For more information, see Tags. Note
These tags apply to the scaling group itself. To add tags to instances within the scaling group, set them in the scaling configuration or launch template. |
|
Tags to propagate to instances |
After adding one or more tags to a scaling group, you can select which of these tags to propagate to the instances that are created during a scale-out activity. |
|
Add existing instances |
This setting is available if scaling group type is ECS and instance configuration source is Launch template or Select Existing Instance. If you set a desired number of instances and add existing instances at the same time, the desired number of instances automatically increases. For example, if you set the desired number of instances to 1 and add 2 existing instances when you create a scaling group, the 2 instances are added to the group after it is created, and the desired number of instances becomes 3. You can entrust the lifecycle of existing instances to the scaling group by selecting the Entrust Instance Lifecycle to Scaling Group checkbox.
Note
You can add subscription instances to a scaling group, but you cannot entrust their lifecycle to the group. |
|
Configure notifications |
Auto Scaling can send notifications by using SMS, internal messages, and email when a scaling activity succeeds, fails, or is rejected. For more information, see Configure notifications. |
|
Resource group |
Assign the scaling group to a resource group to isolate resources and manage permissions. For more information, see Manage scaling groups by using resource groups. |
|
Sync scaling rules to Cloud Monitor |
This feature can be enabled or disabled only when you create the scaling group. When enabled, the system creates and associates a Cloud Monitor application group with the scaling group, and its scaling rules are synchronized and displayed in the Cloud Monitor console. |
YAML parameters
Supported Kubernetes YAML fields
When you deploy a scaling group for ECI using a Kubernetes YAML file, only the following YAML fields in a Kubernetes Deployment resource are supported.
Refer to the sample Deployment on the official Kubernetes website for the YAML file's template structure. A YAML file primarily consists of the kind, metadata, and spec fields.
Extended annotations
When you deploy an ECI-based scaling group using a Kubernetes YAML file, you can only extend the following annotations.