Modifies a scaling group.
Description
- You cannot modify the settings of the following parameters:
- RegionId
- LoadBalancerIdNote If you want to disassociate your scaling group from a Classic Load Balancer (CLB) instance, you can call the DetachLoadBalancers operation. If you want to associate your scaling group with another CLB instance, you can call the AttachLoadBalancers operation.
- DBInstanceId Note If you want to disassociate your scaling group from an ApsaraDB RDS instance, you can call the DetachDBInstances operation. If you want to associate your scaling group with another ApsaraDB RDS instance, you can call the AttachDBInstances operation.
- You can modify a scaling group only when the scaling group is in the Active or Inactive state.
- If you enable a new scaling configuration, Elastic Compute Service (ECS) instances that are created based on the previous scaling configuration still run as expected in the scaling group.
- If the total number of instances in the scaling group is greater than the allowed maximum number after you change the value of the MaxSize parameter, Auto Scaling automatically removes excess instances from the scaling group to ensure that the number of instances is within the new range.
- If the total number of instances in the scaling group is less than the allowed minimum number after you change the value of the MinSize parameter, Auto Scaling automatically adds instances to the scaling group to ensure that the number of instances is within the new range.
- If the total number of instances in the scaling group does not match the expected number of instances after you change the value of the DesiredCapacity parameter, Auto Scaling automatically adds instances to or removes instances from the scaling group to ensure that the number of instances matches the value of the DesiredCapacity parameter.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ModifyScalingGroup | The operation that you want to perform. Set the value to ModifyScalingGroup. |
ScalingGroupId | String | Yes | asg-bp1ffogfdauy0jw0**** | The ID of the scaling group that you want to modify. |
ScalingGroupName | String | No | scalinggroup**** | The name of the scaling group. The name of each scaling group must be unique in a region. The name must be 2 to 64 characters in length, and can contain letters, digits, underscores (_), hyphens (-), and periods (.). The name must start with a letter or a digit. |
MinSize | Integer | No | 1 | The minimum number of ECS instances in the scaling group. When the number of ECS instances in the scaling group is less than the value of the MinSize parameter, Auto Scaling automatically adds ECS instances until the number of instances is equal to the value of the Note The value of the MinSize parameter must be less than or equal to the value of the MaxSize parameter. |
MaxSize | Integer | No | 99 | The maximum number of ECS instances in the scaling group. When the number of ECS instances in the scaling group is greater than the value of the MaxSize parameter, Auto Scaling automatically removes ECS instances from the scaling group until the number of instances is equal to the value of the The value range of the MaxSize parameter varies based on the instance quota. You can go to Quota Center to check the quota of instances that can be added to a scaling group. For example, if the quota of instances that can be added to a scaling group is 2,000, the valid values of the |
DefaultCooldown | Integer | No | 600 | The cooldown time of the scaling group after a scaling activity is triggered. Valid values: 0 to 86400. Unit: seconds. During the cooldown time, Auto Scaling executes only scaling activities that are triggered by event-triggered tasks monitored by CloudMonitor. |
RemovalPolicy.1 | String | No | OldestScalingConfiguration | The first step to remove ECS instances from the scaling group. Valid values:
Note The scaling configuration source specified by OldestScalingConfiguration can be a scaling configuration or a launch template. The CustomPolicy setting is available only for the RemovalPolicy.1 parameter. If you set the RemovalPolicy.1 parameter to CustomPolicy, you must also specify the CustomPolicyARN parameter. |
RemovalPolicy.2 | String | No | NewestInstance | The second step to remove ECS instances from the scaling group. Valid values:
|
RemovalPolicy.3 | String | No | OldestInstance | The third step to remove ECS instances from the scaling group. Valid values:
Note The scaling configuration source specified by OldestScalingConfiguration can be a scaling configuration or a launch template. |
ActiveScalingConfigurationId | String | No | asc-bp17pelvl720x5ub**** | The ID of the active scaling configuration in the scaling group. |
HealthCheckType | String | No | ECS | The health check mode of the scaling group. Valid values:
|
LaunchTemplateId | String | No | lt-m5e3ofjr1zn1aw7**** | The ID of the launch template that is used by Auto Scaling to create instances. |
LaunchTemplateVersion | String | No | Default | The version number of the launch template. Valid values:
|
OnDemandBaseCapacity | Integer | No | 30 | The minimum number of pay-as-you-go instances required in the scaling group. Valid values: 0 to 1000. If the number of pay-as-you-go instances is less than the value of this parameter, Auto Scaling preferentially creates pay-as-you-go instances. If the |
OnDemandPercentageAboveBaseCapacity | Integer | No | 20 | The percentage of pay-as-you-go instances among the excess instances when the requirement on the minimum number of pay-as-you-go instances is met. Valid values: 0 to 100. If the |
SpotInstanceRemedy | Boolean | No | true | Specifies whether to supplement preemptible instances. If you set this parameter to true, Auto Scaling creates an instance to replace a preemptible instance when Auto Scaling receives a system message that indicates the preemptible instance is to be reclaimed. |
CompensateWithOnDemand | Boolean | No | true | Specifies whether to automatically create pay-as-you-go instances to meet the requirement on the number of ECS instances in the scaling group when the number of preemptible instances cannot be reached due to reasons such as costs and insufficient resources. This parameter takes effect only if you set the MultiAZPolicy parameter in the CreateScalingGroup operation to COST_OPTIMIZED. Valid values:
|
SpotInstancePools | Integer | No | 5 | The number of instance types that you specify. Auto Scaling creates preemptible instances of multiple instance types that are provided at the lowest price. Valid values: 0 to 10. If the |
DesiredCapacity | Integer | No | 5 | The expected number of ECS instances in the scaling group. Auto Scaling automatically maintains the expected number of ECS instances that you specify. The expected number cannot be greater than the value of the MaxSize parameter and cannot be less than the value of the MinSize parameter. |
GroupDeletionProtection | Boolean | No | true | Specifies whether to enable deletion protection for the scaling group. Valid values:
|
MultiAZPolicy | String | No | PRIORITY | The scaling policy for the multi-zone scaling group that contains ECS instances. Valid values:
|
VSwitchIds.N | String | No | vsw-bp1oo2a7isyrb8igf**** | The ID of vSwitch N. Valid values of N: 1 to 5. This parameter is available only if the network type of the scaling group is virtual private cloud (VPC). The specified vSwitches and the scaling group must reside in the same VPC. The vSwitches can reside in different zones. The vSwitches are sorted in ascending order based on the value of N. 1 specifies the highest priority. A greater value of N specifies a lower priority. If Auto Scaling fails to create ECS instances in the zone where the vSwitch that has the highest priority resides, Auto Scaling creates ECS instances in the zone where the vSwitch that has the next highest priority resides. |
LaunchTemplateOverride.N.InstanceType | String | No | ecs.c5.xlarge | Instance type N. The instance type that is specified by using this parameter overrides the instance type that is specified in the launch template. If you want to scale instances in the scaling group based on the weighted capacity of instances, you must specify the LaunchTemplateOverride.N.InstanceType and LaunchTemplateOverride.N.WeightedCapacity parameters at the same time. You can specify N instance types by using the Extended Configurations feature of the launch template. Valid values of N: 1 to 10. Note This parameter is available only if you specify the LaunchTemplateId parameter. For information about the valid values of InstanceType in InstanceTypeOverride.N.InstanceType, see Overview of instance families. |
LaunchTemplateOverride.N.WeightedCapacity | Integer | No | 4 | The weight of instance type N. The weight of an instance type specifies the capacity of a single instance of the instance type in the scaling group. If you want to scale instances in the scaling group based on the weighted capacity of instances, you must specify the LaunchTemplateOverride.N.WeightedCapacity parameter after you specify the LaunchTemplateOverride.N.InstanceType parameter. The values of N in the two parameters must be the same. 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 meet the expected capacity requirement, Auto Scaling must create two ecs.c5.xlarge instances. Note The capacity of the scaling group cannot exceed the sum of the maximum number of instances that is specified by the MaxSize parameter and the maximum weight of the instance type. Valid values of WeightedCapacity in the InstanceTypeOverride.N.WeightedCapacity parameter: 1 to 500. |
LaunchTemplateOverride.N.SpotPriceLimit | Float | No | 0.025 | The maximum bid price of instance type N that is specified by the Note This parameter is available only if you specify the LaunchTemplateId parameter. |
AzBalance | Boolean | No | false | Specifies whether to evenly distribute instances in the scaling group across multiple zones. This parameter is available only if you set the
Default value: false. |
AllocationStrategy | String | No | priority | The allocation policy of instances. Auto Scaling selects instance types based on the allocation policy to create instances. The policy can be applied to pay-as-you-go instances and preemptible instances. This parameter is available only if you set the
Default value: priority. |
SpotAllocationStrategy | String | No | lowestPrice | The allocation policy of preemptible instances. You can use this parameter to individually specify the allocation policy of preemptible instances. This parameter is available only if you set the
Default value: priority. |
MaxInstanceLifetime | Integer | No | null | The maximum life span of the instance in the scaling group. Unit: seconds. Valid values: 86400 to Default value: null. Note You cannot specify this parameter for scaling groups that contain elastic container instances or scaling groups whose ScalingPolicy is set to recycle. |
CustomPolicyARN | String | No | acs:fc:cn-zhangjiakou:16145688****:services/ess_custom_terminate_policy.LATEST/functions/ess_custom_terminate_policy_name | The Alibaba Cloud Resource Name (ARN) of the custom scale-in policy (Function). This parameter is available only if you specify CustomPolicy as the first step of the instance removal policy. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** | The ID of the request. |
Examples
Sample requests
http(s)://ess.aliyuncs.com/?Action=ModifyScalingGroup
&ScalingGroupId=asg-bp1ffogfdauy0jw0****
&ScalingGroupName=scalinggroup****
&MinSize=1
&MaxSize=99
&DefaultCooldown=600
&RemovalPolicy.1=OldestScalingConfiguration
&RemovalPolicy.2=NewestInstance
&RemovalPolicy.3=OldestInstance
&ActiveScalingConfigurationId=asc-bp17pelvl720x5ub****
&HealthCheckType=ECS
&LaunchTemplateId=lt-m5e3ofjr1zn1aw7****
&LaunchTemplateVersion=Default
&OnDemandBaseCapacity=30
&OnDemandPercentageAboveBaseCapacity=20
&SpotInstanceRemedy=true
&CompensateWithOnDemand=true
&SpotInstancePools=5
&DesiredCapacity=5
&GroupDeletionProtection=true
&MultiAZPolicy=PRIORITY
&VSwitchIds=["vsw-bp1oo2a7isyrb8igf****"]
&LaunchTemplateOverride=[{"InstanceType":"ecs.c5.xlarge","WeightedCapacity":4,"SpotPriceLimit":0.025}]
&AzBalance=false
&AllocationStrategy=priority
&SpotAllocationStrategy=lowestPrice
&CustomPolicyARN=acs:fc:cn-zhangjiakou:16145688****:services/ess_custom_terminate_policy.LATEST/functions/ess_custom_terminate_policy_name
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<ModifyScalingGroupResponse>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
</ModifyScalingGroupResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}
Error codes
For a list of error codes, see Service error codes.
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. |
400 | InvalidScalingGroupName.Duplicate | The specified value of parameter <parameter name> is duplicated. | The error message returned because the name that you specified for the scaling group already exists. |
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 the instance type of the active scaling configuration. |
400 | InvalidParameter.Conflict | The value of parameter parameter name and parameter parameter name are confilict. | The error message returned because the value of the MinSize parameter is greater than the value of the MaxSize parameter. |
400 | LaunchTemplateVersionSet.NotFound | The specific version of launch template is not exist. | The error message returned because the specified launch template version 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 specified for the LaunchTemplateVersion parameter of the launch template contains non-digit characters. |