ModifyScalingGroup
Modifies a scaling group.
Operation description
Operation description
-
The following parameters cannot be modified:
-
RegionId
-
LoadBalancerId
NoteTo modify load balancing instances, use the AttachLoadBalancers and DetachLoadBalancers operations.
-
DBInstanceId
NoteTo modify ApsaraDB RDS instances, use the AttachDBInstances and DetachDBInstances operations.
-
-
You can invoke this operation only when the scaling group is in the Active or Inactive state.
-
Enabling a new scaling configuration does not affect ECS instances or elastic container instances that were created based on the previous scaling configuration and are still running.
-
If you modify MaxSize and the current number of ECS or elastic container instances in the scaling group exceeds the new MaxSize value, Auto Scaling automatically removes instances from the scaling group until the number equals MaxSize.
-
If you modify MinSize and the current number of ECS or elastic container instances in the scaling group is less than the new MinSize value, Auto Scaling automatically adds instances to the scaling group until the number equals MinSize.
-
If DesiredCapacity is set for the scaling group and you modify DesiredCapacity, Auto Scaling automatically adds or removes ECS or elastic container instances to make the number of instances in the scaling group equal to the new DesiredCapacity value.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ess:ModifyScalingGroup |
update |
*ScalingGroup
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ScalingGroupId |
string |
Yes |
The ID of the scaling group that you want to modify. |
asg-bp1ffogfdauy0jw0**** |
| ScalingGroupName |
string |
No |
The name of the scaling group. The name must be unique within a region. The name must be 2 to 64 characters in length and can contain digits, uppercase letters, lowercase letters, Chinese characters, underscores (_), hyphens (-), and periods (.). |
scalinggroup**** |
| MinSize |
integer |
No |
The minimum number of ECS instances or elastic container instances in the scaling group. When the number of instances in the scaling group is less than Note
The value of |
1 |
| MaxSize |
integer |
No |
The maximum number of ECS instances or elastic container instances in the scaling group. When the number of instances in the scaling group exceeds The valid values of MaxSize depend on your Auto Scaling usage. Go to Quota Center to check the quota value of Maximum Number of Instances in a Scaling Group. For example, if the quota value of Maximum Number of Instances in a Scaling Group is 2000, the valid values of |
99 |
| DefaultCooldown |
integer |
No |
The cooldown time after a scaling activity (adding or removing ECS instances or elastic container instances) is complete. Valid values: 0 to 86400. Unit: seconds. During the cooldown time, the scaling group does not execute other scaling activities. This parameter applies only to scaling activities triggered by CloudMonitor event-triggered tasks. |
600 |
| RemovalPolicy.1 |
string |
No |
指定移出 ECS 实例的第一段伸缩组策略。取值范围:
Note
OldestScalingConfiguration 中提到的伸缩配置泛指组内实例配置信息来源,包括伸缩配置和启动模板。CustomPolicy 仅支持设置为首位移除策略,当指定 CustomPolicy 需同时指定 CustomPolicyARN 参数。 |
OldestScalingConfiguration |
| RemovalPolicy.2 |
string |
No |
指定移出 ECS 实例的第二段伸缩组策略。取值范围:
Note
OldestScalingConfiguration 中提到的伸缩配置泛指组内实例配置信息来源,包括伸缩配置和启动模板。 |
NewestInstance |
| RemovalPolicy.3 |
string |
No |
指定移出 ECS 实例的第三段伸缩组策略。取值范围:
Note
OldestScalingConfiguration 中提到的伸缩配置泛指组内实例配置信息来源,包括伸缩配置和启动模板。 |
OldestInstance |
| ActiveScalingConfigurationId |
string |
No |
The ID of the active scaling configuration in the scaling group. |
asc-bp17pelvl720x5ub**** |
| HealthCheckType |
string |
No |
The health check mode of the scaling group. Valid values:
Default value: ECS. Note
To enable both instance health checks and load balancing health checks, use the |
ECS |
| LaunchTemplateId |
string |
No |
The ID of the launch template from which the scaling group obtains launch configuration information. |
lt-m5e3ofjr1zn1aw7**** |
| LaunchTemplateVersion |
string |
No |
The version of the launch template. Valid values:
|
Default |
| OnDemandBaseCapacity |
integer |
No |
The minimum number of pay-as-you-go instances required in the scaling group. Valid values: 0 to 1000. When the number of pay-as-you-go instances is less than this value, pay-as-you-go instances are preferentially created. When the |
30 |
| OnDemandPercentageAboveBaseCapacity |
integer |
No |
The percentage of pay-as-you-go instances among the excess instances after the minimum number of pay-as-you-go instances (OnDemandBaseCapacity) is met. Valid values: 0 to 100. When the |
20 |
| SpotInstanceRemedy |
boolean |
No |
Specifies whether to supplement spot instances. If this feature is enabled, Auto Scaling creates new instances to replace spot instances that are about to be reclaimed when the system sends a reclamation notification. |
true |
| CompensateWithOnDemand |
boolean |
No |
Specifies whether to automatically create pay-as-you-go instances to meet the required number of ECS instances when spot instances cannot be created due to reasons such as cost or insufficient inventory. This parameter takes effect only when the
|
true |
| SpotInstancePools |
integer |
No |
The number of available instance types. Auto Scaling creates spot instances across multiple lowest-cost instance types in a balanced manner. Valid values: 0 to 10. When the |
5 |
| DesiredCapacity |
integer |
No |
The expected number of ECS instances or elastic container instances in the scaling group. Setting this parameter enables the expected number of instances feature. Auto Scaling automatically maintains the number of instances at the expected level. Valid values: MinSize ≤ expected number of instances ≤ MaxSize. Note
If you disable and then re-enable the expected number of instances feature, you must set the |
5 |
| GroupDeletionProtection |
boolean |
No |
Specifies whether to enable deletion protection for the scaling group. Valid values:
|
true |
| MultiAZPolicy |
string |
No |
The multi-zone scaling policy for ECS instances in the scaling group. Valid values:
|
PRIORITY |
| VSwitchIds |
array |
No |
The IDs of one or more vSwitches. This parameter takes effect only when the network type of the scaling group is VPC. The specified vSwitches must belong to the same VPC as the scaling group. The vSwitches can span multiple zones. The priority of vSwitches is sorted in ascending numerical order, where 1 indicates the highest priority. When an ECS instance cannot be created in the zone of a higher-priority vSwitch, Auto Scaling automatically selects the next-priority vSwitch. |
vsw-bp1oo2a7isyrb8igf**** |
|
string |
No |
The IDs of one or more vSwitches. Valid values of N: 1 to 5. This parameter takes effect only when the network type of the scaling group is VPC. The specified vSwitches must belong to the same VPC as the scaling group. The vSwitches can span multiple zones. The priority of vSwitches is sorted in ascending numerical order, where 1 indicates the highest priority. When an ECS instance cannot be created in the zone of a higher-priority vSwitch, Auto Scaling automatically selects the next-priority vSwitch. |
vsw-bp1oo2a7isyrb8igf**** |
|
| LaunchTemplateOverride |
array<object> |
No |
The launch template override information. |
|
|
object |
No |
The launch template override information. |
||
| InstanceType |
string |
No |
To scale the scaling group based on the capacity of instance types, specify both this parameter and LaunchTemplateOverride.N.WeightedCapacity. This parameter specifies the instance type, which overrides the instance type in the launch template. You can specify N values for this parameter to extend the launch template to support N instance types. Valid values of N: 1 to 20. Note
This parameter takes effect only when the LaunchTemplateId parameter specifies a launch template. Valid values of InstanceType: ECS instance types that are available for purchase. For more information, see Instance families. |
ecs.c5.xlarge |
| WeightedCapacity |
integer |
No |
To scale the scaling group based on the capacity of instance types, specify this parameter after you specify LaunchTemplateOverride.N.InstanceType. The two parameters correspond to each other, and the values of N must be consistent. This parameter specifies the weight of the instance type, which represents the capacity of a single instance of this type in the scaling group. A larger weight means fewer instances of this type are needed to meet the expected capacity. Because instance types differ in vCPU count, memory size, and other performance metrics, you can assign different weights to different instance types based on your requirements. Example:
To meet the expected capacity, Auto Scaling scales out 2 ecs.c5.xlarge instances. Note
During scale-out, the capacity of the scaling group cannot exceed the sum of the maximum capacity (MaxSize) and the maximum weight of the instance types. Valid values of WeightedCapacity: 1 to 500. |
4 |
| SpotPriceLimit |
number |
No |
The maximum bid price for the instance type specified by Note
This parameter takes effect only when the |
0.025 |
| AzBalance |
boolean |
No |
Specifies whether to evenly distribute the capacity of the scaling group across multiple zones. This parameter takes effect only when the
Default value: false. |
false |
| AllocationStrategy |
string |
No |
The capacity allocation strategy that determines how the scaling group selects available instance types to meet capacity requirements. The strategy applies to both pay-as-you-go and spot capacity. This parameter takes effect only when the
Default value: priority. |
priority |
| SpotAllocationStrategy |
string |
No |
The spot capacity allocation strategy. You can use this parameter to separately specify the allocation strategy for spot capacity. This parameter takes effect only when the
Default value: priority. |
lowestPrice |
| MaxInstanceLifetime |
integer |
No |
The maximum amount of time that an instance can remain in the scaling group. Unit: seconds. Valid values: 0 or Default value: null. Note
This parameter is not supported for ECI-type scaling groups or scaling groups with the no-fees-for-stopped-instances feature enabled. |
null |
| CustomPolicyARN |
string |
No |
The Alibaba Cloud Resource Name (ARN) of the custom scale-in policy Function Compute function. This parameter takes effect only when the first scale-in policy in RemovalPolicies is set to CustomPolicy. |
acs:fc:cn-zhangjiakou:16145688****:services/ess_custom_terminate_policy.LATEST/functions/ess_custom_terminate_policy_name |
| DisableDesiredCapacity |
boolean |
No |
Specifies whether to disable the expected number of instances feature for the scaling group. Valid values:
Note
You can set this parameter to true only when no scaling activity is in progress. When the expected number of instances feature is disabled, the |
false |
| ScalingPolicy |
string |
No |
The reclaim mode of the scaling group. Valid values:
ScalingPolicy specifies the reclaim mode of the scaling group, but the specific action taken when instances are removed from the scaling group is determined by the RemovePolicy parameter of RemoveInstances. For more information, see RemoveInstances. |
recycle |
| HealthCheckTypes |
array |
No |
The health check modes of the scaling group. Note
You can set multiple values for this parameter to enable multiple health check options. If the |
|
|
string |
No |
The list of health check modes for the scaling group. Valid values:
Default value: ECS. |
ECS |
|
| StopInstanceTimeout |
integer |
No |
The timeout period for waiting for an ECS instance to stop during a scale-in flow. Unit: seconds. Valid values: 30 to 240. Note
|
60 |
| CapacityOptions |
object |
No |
The capacity options. |
|
| OnDemandBaseCapacity |
integer |
No |
The minimum number of pay-as-you-go instances required in the scaling group. When the number of pay-as-you-go instances is less than this value, pay-as-you-go instances are preferentially created. Valid values: 0 to 1000. When the |
30 |
| OnDemandPercentageAboveBaseCapacity |
integer |
No |
The percentage of pay-as-you-go instances among the excess instances after the minimum number of pay-as-you-go instances ( When the |
20 |
| CompensateWithOnDemand |
boolean |
No |
Specifies whether to automatically create pay-as-you-go instances to meet the required number of ECS instances when spot instances cannot be created due to reasons such as cost or insufficient inventory. This parameter takes effect only when the
|
true |
| SpotAutoReplaceOnDemand |
boolean |
No |
Specifies whether to use spot instances to replace pay-as-you-go instances when
Default value: false. |
true |
| PriceComparisonMode |
string |
No |
The price comparison mode for the cost optimization strategy of the scaling group. Valid values:
Default value: PricePerUnit. |
PricePerUnit |
| BalanceMode |
string |
No |
The zone balancing mode. This parameter takes effect only when zone balancing is enabled. Valid values:
Default value: BalancedBestEffort. |
BalancedBestEffort |
| AutoRebalance |
boolean |
No |
Specifies whether to enable automatic rebalancing for the scaling group. This parameter takes effect only when BalancedOnly is enabled for a zone-balanced scaling group. Valid values:
Default value: false. |
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** |
Examples
Success response
JSON format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.