Enables a scaling group.
Description
You can call this operation to enable a scaling group that is in the Inactive state and has an instance configuration source. The instance configuration source can be a scaling configuration, a launch template, or Elastic Compute Service (ECS) instances that you specified when you created the scaling group. If a scaling group is not in the Inactive state or does not have an instance configuration source, you cannot call this operation to enable the scaling group.
If you specify a value for the InstanceId.N parameter when you call the operation, Auto Scaling checks whether the total number of ECS instances is within the range allowed for the scaling group after you call the operation.
- If the total number of ECS instances is less than the minimum number of instances allowed in the scaling group after you call the operation, Auto Scaling automatically creates the required number of pay-as-you-go ECS instances to reach the minimum number. For example, if the minimum number of instances allowed in your scaling group is five, and you specify the InstanceId.N parameter to add two created ECS instances to the scaling group, Auto Scaling automatically creates three instances in the scaling group after the two instances are added.
- If the total number of instances is greater than the maximum number of instances allowed in the scaling group, the operation fails to be called.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | EnableScalingGroup |
The operation that you want to perform. Set the value to EnableScalingGroup. |
ScalingGroupId | String | Yes | asg-bp14wlu85wrpchm0**** |
The ID of the scaling group. |
ActiveScalingConfigurationId | String | No | asc-bp1ffogfdauy0nu5**** |
The ID of the scaling configuration that you need to put into the Active state. |
LaunchTemplateId | String | No | lt-m5e3ofjr1zn1aw7**** |
The ID of the launch template that you want to use to create instances. |
LaunchTemplateVersion | String | No | Default |
The version number of the launch template. Valid values:
|
RegionId | String | No | cn-qingdao |
The ID of the region where the scaling group resides. |
InstanceId.N | String | No | i-283vv**** |
The ID of instance N that you want to add to the scaling group after the scaling group is enabled. Valid values of N: 1 to 20. Before you add ECS instances to a scaling group, make sure that the instances meet the following requirements:
|
LoadBalancerWeight.N | Integer | No | 50 |
The weight of instance N that serves as a backend server of the associated Server Load Balancer (SLB) instance. Valid values of N: 1 to 20. Valid values of this parameter: 1 to 100. Default value: 50. |
LaunchTemplateOverride.N.InstanceType | String | No | ecs.c5.xlarge |
If you want to scale instances in the scaling group based on the weighted capacity of instance types, you must specify the LaunchTemplateOverride.N.InstanceType and LaunchTemplateOverride.N.WeightedCapacity parameters at the same time. This parameter specifies instance type N that overrides the instance type specified in the launch template. You can specify N instance types in the extended configurations of the launch template. Valid values of N: 1 to 10. Note This parameter takes effect only when the LaunchTemplateId parameter is specified.
For information about the valid values of InstanceType in InstanceTypeOverride.N.InstanceType, see Instance families. |
LaunchTemplateOverride.N.WeightedCapacity | Integer | No | 4 |
If you want to scale instances in the scaling group based on the weighted capacity of instance types, you must specify the LaunchTemplateOverride.N.WeightedCapacity parameter after you specify the LaunchTemplateOverride.N.InstanceType parameter. The two parameters have a one-to-one correspondence. The value of N in the two parameters must be the same. This parameter specifies the weight of the instance type. The weight specifies the capacity of a single 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. 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. Examples:
To meet the expected capacity, Auto Scaling creates two ecs.c5.xlarge instances. Note The capacity of the scaling group cannot exceed the sum of the maximum capacity that
is specified by MaxSize and the maximum weight of the instance type.
Valid values of WeightedCapacity in LaunchTemplateOverride.N.WeightedCapacity: 1 to 500. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
The ID of the request. |
Examples
Sample requests
http(s)://ess.aliyuncs.com/?Action=EnableScalingGroup
&ScalingGroupId=asg-bp14wlu85wrpchm0****
&ActiveScalingConfigurationId=asc-bp1ffogfdauy0nu5****
&LaunchTemplateId=lt-m5e3ofjr1zn1aw7****
&LaunchTemplateVersion=Default
&InstanceId=["i-283vv****"]
&LoadBalancerWeight=[50]
&LaunchTemplateOverride=[{"InstanceType":"ecs.c5.xlarge","WeightedCapacity":4}]
&RegionId=cn-qingdao
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<EnableScalingGroupResponse>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</EnableScalingGroupResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Error codes
For a list of error codes, visit the API Error Center.
HTTP status code |
Error code |
Error message |
Description |
---|---|---|---|
404 |
InvalidScalingGroupId.NotFound |
The specified scaling group does not exist. |
The error message returned because the specified scaling group does not exist within the Alibaba Cloud account. |
403 |
Forbidden.Unauthorized |
A required authorization for the specified action is not supplied. |
The error message returned because Auto Scaling is not authorized to call the operation. |
400 |
IncorrectScalingGroupStatus |
The current status of the specified scaling group does not support this action. |
The error message returned because the specified scaling group is being deleted. |
404 |
InvalidScalingConfigurationId.NotFound |
The specified scaling configuration does not exist. |
The error message returned because the specified scaling configuration does not exist in the scaling group. |
400 |
InvalidScalingConfigurationId.InstanceTypeMismatch |
The specified scaling configuration and existing active scaling configuration have different instance type. |
The error message returned because the instance type of the specified scaling configuration is different from that of the scaling configuration that is in the Active state. |
400 |
MissingActiveScalingConfiguration |
An active scaling configuration for the specified scaling group is not supplied. |
The error message returned because no scaling configuration in the scaling group is in the Active state. |
404 |
InvalidInstanceId.NotFound |
Instance "XXX" does not exist. |
The error message returned because the specified ECS instance does not exist within the Alibaba Cloud account. |
400 |
InvalidInstanceId. RegionMismatch |
Instance "XXX" and the specified scaling group are not in the same Region. |
The error message returned because the specified ECS instance and the scaling group do not reside in the same region. |
400 |
InvalidInstanceId. InstanceTypeMismatch |
Instance "XXX" and existing active scaling configuration have different instance type. |
The error message returned because the instance type of the specified ECS instance is different from the instance type that is specified in the active scaling configuration. |
400 |
IncorrectInstanceStatus |
The current status of instance "XXX" does not support this action. |
The error message returned because the specified ECS instance is not in the Running state. |
400 |
InvalidInstanceId. NetworkTypeMismatch |
The network type of instance "XXX" does not support this action. |
The error message returned because the network type of the specified ECS instance is different from that of the scaling group. |
400 |
InvalidInstanceId.VPCMismatch |
Instance "XXX" and the specified scaling group are not in the same VPC. |
The error message returned because the added ECS instance and the specified scaling group do not reside in the same VPC. |
400 |
InvalidInstanceId.InUse |
Instance "XXX" is already attached to another scaling group. |
The error message returned because the specified ECS instance is already added to another scaling group. |
400 |
IncorrectLoadBalancerStatus |
The current status of the specified load balancer does not support this action. |
The error message returned because the specified SLB instance is not in the Active state. |
400 |
IncorrectLoadBalancerHealthCheck |
The current health check type of specified load balancer does not support this action. |
The error message returned because the health check feature is not enabled for the specified SLB instance. |
400 |
InvalidLoadBalancerId.IncorrectInstanceNetworkType |
The network type of the instance in specified Load Balancer does not support this action. |
The error message returned because the network type of the ECS instance that is attached to the specified SLB instance is different from that of the scaling group. |
400 |
InvalidLoadBalancerId.VPCMismatch |
The specified virtual switch and the instance in specified Load Balancer are not in the same VPC. |
The error message returned because the ECS instance that is attached to the specified SLB instance does not reside in the same VPC as that of the vSwitch specified by VSwitchID. |
400 |
IncorrectDBInstanceStatus |
The current status of DB instance "XXX" does not support this action. |
The error message returned because the specified ApsaraDB RDS instance is not in the Running state. |
400 |
IncorrectCapacity.MaxSize |
To attach the instances, the total capacity will be greater than the max size. |
The error message returned because the total number of ECS instances is greater than the maximum number of instances allowed after a specified number of instances are added to the scaling group. |
400 |
LaunchTemplateVersionSet.NotFound |
The specific version of launch template is not exist. |
The error message returned because the specified version of the launch template does not exist. |
400 |
LaunchTemplateSet.NotFound |
The specified launch template set is not found. |
The error message returned because the specified launch template does not exist. |
400 |
TemplateMissingParameter.ImageId |
The input parameter "ImageId" that is mandatory for processing this request is not supplied. |
The error message returned because the ImageId parameter that is required for the specified launch template is not specified. |
400 |
TemplateMissingParameter.InstanceTypes |
The input parameter "InstanceTypes" that is mandatory for processing this request is not supplied. |
The error message returned because the InstanceTypes parameter that is required for the specified launch template is not specified. |
400 |
TemplateMissingParameter.SecurityGroup |
The input parameter "SecurityGroup" that is mandatory for processing this request is not supplied. |
The error message returned because the SecurityGroup parameter that is required for the specified launch template is not specified. |
400 |
TemplateVersion.NotNumber |
The input parameter "LaunchTemplateVersion" is supposed to be a string representing the version number. |
The error message returned because the fixed version number that is specified for the LaunchTemplateVersion parameter contains non-digit characters. |