Modifies the attributes of a scaling group, such as the maximum, minimum, and expected numbers of instances. This eliminates the need to recreate and reconfigure scaling groups.
Operation description
-
The following parameters cannot be modified:
-
RegionId
-
LoadBalancerId
NoteTo modify an SLB instance, use the AttachLoadBalancers and DetachLoadBalancers APIs.
-
DBInstanceId
NoteTo modify an RDS instance, use the AttachDBInstances and DetachDBInstances APIs.
-
-
You can invoke this API only when the scaling group status is
ActiveorInactive. -
Enabling a new scaling configuration does not affect ECS instances or ECI instances that were created using an earlier scaling configuration and are currently running.
-
If MaxSize is modified such that the current number of ECS or ECI instances in the scaling group exceeds MaxSize, the scaling group automatically removes ECS or ECI instances until the instance count equals MaxSize.
-
If MinSize is modified such that the current number of ECS or ECI instances in the scaling group falls below MinSize, the scaling group automatically adds ECS or ECI instances until the instance count equals MinSize.
-
If DesiredCapacity is set for the scaling group and then modified such that the current number of ECS or ECI instances differs from the new DesiredCapacity, the scaling group automatically adds or removes ECS or ECI instances until the instance count equals DesiredCapacity.
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 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. |
scalinggroup**** |
| MinSize |
integer |
No |
The minimum number of ECS instances or elastic container instances in the scaling group. If the current number of instances falls below this value, Auto Scaling automatically adds instances to meet the minimum. Note
The value of MinSize must be less than or equal to the value of MaxSize. |
1 |
| MaxSize |
integer |
No |
The maximum number of ECS instances or elastic container instances in the scaling group. If the current number of instances exceeds this value, Auto Scaling automatically removes the surplus instances. The value range of MaxSize depends on your Auto Scaling quota. You can go to Quota Center to check the maximum number of instances that a single scaling group can contain. For example, if a scaling group can contain up to 2,000 instances, the value range of MaxSize is 0 to 2000. |
99 |
| DefaultCooldown |
integer |
No |
The cooldown period of the scaling group. This parameter is available only if you set ScalingRuleType to SimpleScalingRule. Valid values: 0 to 86400. Unit: seconds. During the cooldown period, Auto Scaling does not execute scaling activities that are triggered by CloudMonitor event-triggered tasks. |
600 |
| RemovalPolicies |
array |
No |
The policy that is used to remove ECS instances from the scaling group. Valid values:
|
|
|
string |
No |
The policy that is used to remove ECS instances from the scaling group. Valid values:
|
NewestInstance |
|
| 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:
Note
If you want to enable instance health check and load balancer health check at the same time, we recommend that you specify |
ECS |
| LaunchTemplateId |
string |
No |
The ID of the launch template that is used by Auto Scaling to create instances. |
lt-m5e3ofjr1zn1aw7**** |
| LaunchTemplateVersion |
string |
No |
The version number of the launch template. Valid values:
|
Default |
| OnDemandBaseCapacity |
integer |
No |
The minimum number of pay-as-you-go instances that must be included 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 you set the |
30 |
| OnDemandPercentageAboveBaseCapacity |
integer |
No |
The expected percentage of pay-as-you-go instances in the excess instances when the minimum number of pay-as-you-go instances reaches the requirement. Valid values: 0 to 100. If you set the |
20 |
| SpotInstanceRemedy |
boolean |
No |
Specifies whether to supplement preemptible instances. If set to true, Auto Scaling creates a replacement instance when it receives a notification that a preemptible instance is about to be reclaimed. |
true |
| CompensateWithOnDemand |
boolean |
No |
Specifies whether to automatically create pay-as-you-go instances to meet the required number of ECS instances when preemptible instances cannot be created due to cost or insufficient resources. This parameter takes effect only if you set
|
true |
| SpotInstancePools |
integer |
No |
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 you set the |
5 |
| DesiredCapacity |
integer |
No |
The expected number of ECS instances or elastic container instances in the scaling group. Auto Scaling automatically maintains this number. The value must satisfy: MaxSize ≥ DesiredCapacity ≥ MinSize. Note
If you re-enable the Expected Number of Instances feature, you must specify a value for |
5 |
| GroupDeletionProtection |
boolean |
No |
Specifies whether to enable deletion protection for the scaling group. Valid values:
|
true |
| MultiAZPolicy |
string |
No |
The scaling policy for the multi-zone scaling group that contains ECS instances. Valid values:
Note
The
|
PRIORITY |
| VSwitchIds |
array |
No |
The IDs of vSwitches. This parameter takes effect only when 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. The first vSwitch specified by using the VSwitchIds parameter has the highest 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. |
|
|
string |
No |
The IDs of vSwitches. This parameter takes effect only when the network type of the scaling group is 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. The first vSwitch specified by using the VSwitchIds parameter has the highest 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. |
vsw-bp1oo2a7isyrb8igf**** |
|
| LaunchTemplateOverrides |
array<object> |
No |
The information about the instance types that are extended in the launch template. |
|
|
object |
No |
Details of the instance type that you specify by using the Extended Configurations feature of the launch template. |
||
| InstanceType |
string |
No |
The instance type that you want to use to override the instance type that is specified in the launch template. 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 |
If you want to scale the scaling group based on the instance types, you must specify LaunchTemplateOverrides.InstanceType before you specify this parameter. The two parameters have a one-to-one correspondence. 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. Sample capacity configurations:
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 |
| SpotPriceLimit |
number |
No |
The maximum bid price of instance type N that is specified by Note
This parameter takes effect only if you use |
0.025 |
| MaxInstanceLifetime |
integer |
No |
The maximum life span of the instance in the scaling group. Unit: seconds. Valid values: 86400 to Integer.maxValue. ``You can also set this parameter to 0. A value of 0 indicates that the instance has an unlimited life span in the scaling group. Default value: null. Note
You cannot specify this parameter for scaling groups that manage elastic container instances or scaling groups whose ScalingPolicy is set to recycle. |
null |
| AzBalance |
boolean |
No |
Specifies whether to evenly distribute instances in the scaling group across zones. This parameter takes effect only when you set the
Default value: false. |
false |
| AllocationStrategy |
string |
No |
The allocation policy. Auto Scaling selects instance types based on the allocation policy to create the required number of instances. The policy can be applied to pay-as-you-go instances and preemptible instances at the same time. This parameter takes effect only when you set the MultiAZPolicy parameter to COMPOSABLE. Valid values:
Default value: priority. |
priority |
| SpotAllocationStrategy |
string |
No |
The allocation policy of preemptible instances. You can use this parameter to individually specify the allocation policy of preemptible instances. This parameter takes effect only when you set the
Default value: priority. |
lowestPrice |
| CustomPolicyARN |
string |
No |
The ARN of the custom scaling policy (Function). This parameter takes effect only when you specify CustomPolicy as the first step of the instance removal policy. |
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 (to disable the expected number of instances feature) only when no scaling activity is currently running in the scaling group. When this feature is disabled, the current DesiredCapacity property of the scaling group is cleared, but the actual number of instances in the scaling group remains unchanged. |
false |
| ScalingPolicy |
string |
No |
The reclaim mode of the scaling group. Valid values:
ScalingPolicy specifies only the reclaim mode of the scaling group. RemovePolicy of the RemoveInstances operation specifies the manner how instances are removed from the scaling group. For more information, see RemoveInstances. |
recycle |
| HealthCheckTypes |
array |
No |
The health check mode of the scaling group. Note
You can specify multiple values for this parameter to enable multiple health check options at the same time. If you specify HealthCheckType, this parameter is ignored. |
|
|
string |
No |
The health check modes of the scaling group. Valid values:
Default value: ECS. |
ECS |
|
| StopInstanceTimeout |
integer |
No |
The timeout period for an ECS instance to enter the Stopped state during scale-in. 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 drops below the value of this parameter, Auto Scaling preferentially creates pay-as-you-go instances. Valid values: 0 to 1000. If you set |
30 |
| OnDemandPercentageAboveBaseCapacity |
integer |
No |
The percentage of additional pay-as-you-go instances beyond the minimum required by If you set |
20 |
| CompensateWithOnDemand |
boolean |
No |
Specifies whether to automatically create pay-as-you-go ECS instances to reach the required number of ECS instances when preemptible ECS instances cannot be created due to high prices or insufficient resources. This parameter takes effect only if you set
|
true |
| SpotAutoReplaceOnDemand |
boolean |
No |
Specifies whether to replace pay-as-you-go instances with preemptible instances. When
Default value: false. |
true |
| PriceComparisonMode |
string |
No |
The price comparison mode. Valid values:
Default value: PricePerUnit. |
PricePerUnit |
| BalanceMode |
string |
No |
The zone balancing mode. This mode takes effect only when the zone balancing mode is enabled. Valid values:
Default value: BalancedBestEffort. |
BalancedBestEffort |
| AutoRebalance |
boolean |
No |
Whether to enable automatic rebalancing for the scaling group. This takes effect only when BalancedOnly is enabled for the scaling group. Valid values:
Default value: false. |
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The ID of the request. |
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.