Modifies a scaling group.
Operation description
-
You cannot call this operation to modify the settings of the following parameters:
-
RegionId
-
LoadBalancerId
Note If you want to change the CLB instances that are associated with your scaling group, call the AttachLoadBalancers and DetachLoadBalancers operations.-
DBInstanceId
Note If you want to change the ApsaraDB RDS instances that are associated with your scaling group, call the AttachDBInstances and DetachDBInstances operations. -
-
You can modify only scaling groups that are 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 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
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:ModifyScalingGroup | Write |
|
| 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 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 creates ECS instances and adds the instances to the scaling group until the number of instances is equal to the value of the MinSize parameter. Note
The value of the MinSize parameter must be less than or equal to the value of the MaxSize parameter.
| 1 |
MaxSize | integer | No | 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 MaxSize parameter. 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 included in a scaling group. For example, if the quota of instances that can be included in a scaling group is 2000, the valid values of the MaxSize parameter range from 0 to 2000. | 99 |
DefaultCooldown | integer | No | The default cooldown time of the scaling group. This parameter takes effect only for scaling groups that have simple scaling rules. Valid values: 0 to 86400. Unit: seconds. During the cooldown time, Auto Scaling executes only scaling activities that are triggered by event-triggered tasks associated with CloudMonitor. | 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:
| 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 this parameter is set to true, Auto Scaling creates an instance to replace a preemptible instance when Auto Scaling receives the system message that the preemptible instance is to be reclaimed. | true |
CompensateWithOnDemand | boolean | No | Specifies whether to automatically create pay-as-you-go instances to meet the requirements 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:
| 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 in the scaling group. Auto Scaling automatically maintains the specified expected number of ECS instances. The expected number cannot be greater than the value of the MaxSize parameter and cannot be less than the value of the MinSize parameter. | 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 COST_OPTIMIZED setting takes effect only when multiple instance types are specified or at least one instance type is specified for preemptible instances.
| 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 | object [] | No | Details of the instance types that are specified in the extended configurations of the launch template. | |
InstanceType | string | No | The instance type. The instance type that you specify by using the InstanceType parameter overwrites the instance type that is specified in the launch template. If you want Auto Scaling to scale instances in the scaling group based on the instance type weight, you must specify both the InstanceType and WeightedCapacity parameters. Note
This parameter takes effect only after you specify the LaunchTemplateId parameter.
You can use the InstanceType parameter to specify only instance types that are available for purchase. | ecs.c5.xlarge |
WeightedCapacity | integer | No | The weight of the instance type. The weight specifies the capacity of a single instance of the specified instance type in the scaling group. If you want Auto Scaling to scale instances in the scaling group based on the weighted capacity of instances, you must specify the WeightedCapacity parameter after you specify the InstanceType parameter. 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. Example:
To meet the expected capacity requirement, Auto Scaling must create and add 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 the WeightedCapacity parameter: 1 to 500. | 4 |
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 |
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 modes of the scaling group. Valid values:
| |
string | No | The health check mode of the scaling group. Valid values:
| ECS |
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 | ||||
---|---|---|---|---|---|---|
2024-02-22 | The request parameters of the API has changed | see changesets | ||||
| ||||||
2024-02-01 | The request parameters of the API has changed | see changesets | ||||
| ||||||
2023-10-18 | The request parameters of the API has changed | see changesets | ||||
| ||||||
2022-12-22 | The internal configuration of the API is changed, but the call is not affected | see changesets | ||||
|