Enables a scaling group. If a scaling group is in the Disabled state and contains an instance configuration source such as a launch template or a scaling configuration, you can call the EnableScalingGroup operation to enable the scaling group. This operation permits Auto Scaling to dynamically adjust the computing power (also known as the number of instances) in the scaling group based on your business requirements.
Operation description
-
You can call this operation to enable a scaling group only if the scaling group is in the Inactive state and contains an instance configuration source such as a launch temple or a scaling configuration. The instance configuration source can also be the Elastic Compute Service (ECS) instance that you specified when you created the scaling group. If the preceding requirements are not met, the operation will fail.
**
Note A scaling group can have only one active instance configuration source at a time. When you call this operation to enable a scaling group, you can specify a scaling configuration or a launch template for the scaling group. If the scaling group already have an instance configuration source defined prior to your calling, the scaling configuration or launch template specified within your request will supersede the existing scaling configuration or launch template.
-
If you specify InstanceId.N to add to the scaling group within your request, Auto Scaling will check whether the addition of InstanceId.N will cause the total number of ECS instances in the scaling group to fall outside the boundaries specified by MinSize and MaxSize after you call this operation.
- If the call results in the total number of ECS instances dropping below the value of MinSize, Auto Scaling proactively creates pay-as-you-go ECS instances to ensure that the total number reaches the minimum threshold. For example, if you set MinSize to 5 when you created a scaling group and include InstanceId.N within your request to add two ECS instances when you attempt to enable the scaling group, Auto Scaling creates three more ECS instances in the scaling group after the two ECS instances are added.
- If the call results in the total number of ECS instances exceeding the value of MaxSize, the operation fails.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ess:EnableScalingGroup | update |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ScalingGroupId | string | Yes | The ID of the scaling group. | asg-bp14wlu85wrpchm0**** |
ActiveScalingConfigurationId | string | No | The ID of the scaling configuration that you want to enable in the scaling group. | asc-bp1ffogfdauy0nu5**** |
LaunchTemplateId | string | No | The ID of the launch template that is used by Auto Scaling to create ECS instances. | lt-m5e3ofjr1zn1aw7**** |
LaunchTemplateVersion | string | No | The version number of the launch template. Valid values:
| Default |
InstanceIds | array | No | The IDs of the ECS instances that you want to add to the scaling group after the scaling group is enabled. Before you add ECS instances to the scaling group, make sure that the instances meet the following requirements:
| |
string | No | The ID of the ECS instance that you want to add to the scaling group after the scaling group is enabled. Before you add an ECS instance to the scaling group, make sure that the instance meets the following requirements:
| i-283vv**** | |
LoadBalancerWeights | array | No | The weights of ECS instances or elastic container instances as backend servers. Default value: 50. | |
integer | No | The weight of an ECS instance or elastic container instance as a backend server. Default value: 50. | 50 | |
LaunchTemplateOverrides | array<object> | No | The information about the instance types that you want to extend in the launch template. | |
object | No | Details of the instance types that are specified in the extended configurations of the launch template. | ||
InstanceType | string | No | The instance type. If you want to scale instances based on instance type weights in the scaling group, you must specify The instance type specified by using this parameter overwrites the instance type of the launch template. Note
This parameter takes effect only if you specify LaunchTemplateId.
You can use this parameter to specify any instance types that are available for purchase. | ecs.c5.xlarge |
WeightedCapacity | integer | No | The weight of the instance type. If you want to scale instances based on instance type weights in the scaling group, you must specify this parameter after you specify The weight specifies the capacity of an instance of the specified instance type in the scaling group. A higher weight specifies that a smaller number of instances of the specified instance type are required to meet the expected capacity requirement. Performance metrics such as the number of vCPUs and the memory size of each instance type may vary. You can specify different weights for different instance types based on your business requirements. Example:
To reach the expected capacity, Auto Scaling must scale out two instances of ecs.c5.xlarge. Note
The total capacity of the scaling group is constrained and cannot surpass the combined total of the maximum group size defined by MaxSize and the highest weight assigned to any instance type.
Valid values of WeightedCapacity: 1 to 500. | 4 |
RegionId | string | No | The region ID of the scaling group. | cn-qingdao |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|