All Products
Search
Document Center

Auto Scaling:CreateScalingGroup

最終更新日:Dec 17, 2024

Creates a scaling group. You can call the CreateScalingGroup operation to automate the adjustment of computing power of a specific type based on your business requirements and scaling polices.

Operation description

A scaling group is a group of Elastic Compute Service (ECS) instances that can be used for similar purposes.

You can create only a limited number of scaling groups in a region. To check the quota of the scaling groups, go to Quota Center.

A scaling group does not immediately take effect after you create the scaling group. You can call the EnableScalingGroup operation to enable a scaling group. You can trigger scaling events and execute scaling rules only in scaling groups that are in the Enabled state.

If you want to attach a Classic Load Balancer (CLB, formerly known as SLB) instance and an ApsaraDB RDS instance to the scaling group that you want to create, the scaling group, the CLB instance, and the ApsaraDB RDS instance must reside in the same region. For more information, see Regions and zones.

If you attach a CLB instance to the scaling group that you want to create, Auto Scaling automatically adds the ECS instances in the scaling group to the backend server groups of the CLB instance. You can specify the following types of server groups to add ECS instances:

  • Default server group: ECS instances in this group process frontend requests. If no listeners are configured for vServer groups or primary/secondary server groups, the frontend requests are forwarded to the ECS instances in the default server group.
  • vServer group: If you want to forward different requests to different backend servers, or you want to forward requests based on domain names or URLs, you can specify vServer groups.
Note If you specify both the default server group and multiple server groups simultaneously, Auto Scaling adds the ECS instances in your scaling group to these server groups concurrently.

The default weight of each ECS instance as a backend server is 50. If you want to attach a CLB instance to the scaling group that you want to create, make sure that the CLB instance meets the following requirements:

  • The CLB instance is in the Active state. You can call the DescribeLoadBalancers operation to query the status of CLB instances.
  • Health check must be enabled on all listener ports configured for the CLB instance. Otherwise, the scaling group will fail to be created.

If you attach Application Load Balancer (ALB) or Network Load Balancer (NLB) server groups to the scaling group that you want to create, Auto Scaling adds the ECS instances in your scaling group to the ALB or NLB server groups to process the access requests forwarded by the corresponding ALB or NLB instances. You can attach multiple ALB or NLB server groups to a scaling group. Make sure that the ALB or NLB server groups belong to the same virtual private cloud (VPC). For more information, see AttachAlbServerGroups or AttachServerGroups .

If you attach an ApsaraDB RDS instance to the scaling group that you want to create, Auto Scaling automatically adds the private IP addresses of the ECS instances in your scaling group to the IP address whitelist of the ApsaraDB RDS instance. Before you attach an ApsaraDB RDS instance to your scaling group, make sure that the ApsaraDB RDS instance meets the following requirements:

  • The ApsaraDB RDS instance is in the Running state. You can call the DescribeDBInstances state to query the status of ApsaraDB RDS instances.
  • The number of IP addresses in the IP address whitelist of the ApsaraDB RDS instance does not reach its upper limit. For more information, see Configure a whitelist.

If you set MultiAZPolicy for the scaling group that you want to create to COST_OPTIMIZED, the following rules apply:

  • If you use OnDemandBaseCapacity, OnDemandPercentageAboveBaseCapacity, and SpotInstancePools to specify the instance allocation mode under the cost optimization policy, Auto Scaling prioritizes the implementation of the specified instance allocation mode during scale-out events.
  • If you do not specify OnDemandBaseCapacity, OnDemandPercentageAboveBaseCapacity, or SpotInstancePools, Auto Scaling preferentially creates instances of the lowest-priced instance type based on the cost optimization policy.

If you set Tags.Propagate to true, the following rules will apply:

  • Tags that you add to the scaling group cannot be propagated to existing instances in the scaling group. Tags that you add to the scaling group are propagated to only new instances.
  • If you specify instance tags in the scaling configuration that is used to create instances and propagate the tags that you add to the scaling group to the instances, all tags exist at the same time.
  • If the tag key that you specify in a scaling configuration and the tag key that you add to the scaling group of the scaling configuration are the same, the tag value that you specify in the scaling configuration is preferentially used.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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.
OperationAccess levelResource typeCondition keyAssociated operation
ess:CreateScalingGroupcreate
*ScalingGroup
acs:ess:{#regionId}:{#accountId}:scalinggroup/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ScalingGroupNamestringNo

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.

If you do not specify this parameter, the value of the ScalingGroupId parameter is used.

scalinggroup****
LaunchTemplateIdstringNo

The ID of the launch template that provides instance configurations for Auto Scaling to create instances.

lt-m5e3ofjr1zn1aw7****
LaunchTemplateVersionstringNo

The version number of the launch template. Valid values:

  • A fixed template version number.
  • Default: the default template version.
  • Latest: the latest template version.
Default
InstanceIdstringNo

The ID of the ECS instance. When you create a scaling group, you can specify an existing ECS instance. Auto Scaling obtains the configurations of the ECS instance and automatically creates a scaling configuration from the obtained configurations.

i-28wt4****
RegionIdstringYes

The region ID of the scaling group.

cn-qingdao
MinSizeintegerYes

The minimum number of instances that must be contained in the scaling group. When the total number of ECS instances in the scaling group is less than the value of MinSize, Auto Scaling automatically creates ECS instances in the scaling group until the total number reaches the minimum number.

Note The value of MinSize must be less than or equal to the value of MaxSize.
2
MaxSizeintegerYes

The maximum number of instances that can be contained in the scaling group. When the total number of ECS instances in the scaling group exceeds the value of MaxSize, Auto Scaling automatically removes ECS instances from the scaling group until the total number equals the maximum number.

The value range of MaxSize is directly correlated with the degree of dependency your business has on Auto Scaling. You can go to Quota Center to check the maximum number of instances that a single scaling group can contain.

If a single scaling group can contain up to 2,000 ECS instances, the value range of MaxSize is 0 to 2,000.

20
DefaultCooldownintegerNo

The cooldown period of the scaling group after a scaling activity is complete in the scaling group. 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.

Default value: 300.

300
LoadBalancerIdsstringNo

The IDs of the CLB instances that you want to associate with the scaling group. The value can be a JSON array that contains multiple CLB instance IDs. Separate multiple IDs with commas (,).

You can associate only a limited number of CLB instances with a scaling group. Go to Quota Center to check the maximum number of CLB instances that you can associate with a scaling group.

["lb-bp1u7etiogg38yvwz****", "lb-bp168cqrux9ai9l7f****", "lb-bp1jv3m9zvj22ufxp****"]
DBInstanceIdsstringNo

The IDs of the ApsaraDB RDS instances that you want to associate with the scaling group. The value can be a JSON array that contains multiple ApsaraDB RDS instance IDs. Separate multiple IDs with commas (,).

You can associate only a limited number of ApsaraDB RDS instances with a scaling group. Go to Quota Center to check the maximum number of ApsaraDB RDS instances that you can associate with a scaling group.

["rm-bp142f86de0t7****", "rm-bp18l1z42ar4o****", "rm-bp1lqr97h4aqk****"]
RemovalPoliciesarrayNo

The instance removal policies. Valid values:

  • OldestInstance: removes ECS instances that are added at the earliest point in time to the scaling group.
  • NewestInstance: removes ECS instances that are most recently added to the scaling group.
  • OldestScalingConfiguration: removes ECS instances that are created based on the earliest scaling configuration.
  • CustomPolicy: removes ECS instances based on the custom scale-in policy (Function).

The scaling configuration source specified by the OldestScalingConfiguration setting can be a scaling configuration or a launch template. The CustomPolicy setting takes effect only if you specify it as the first step to remove instances. If you specify CustomPolicy, you must also specify the CustomPolicyARN parameter.

Note The removal of ECS instances from a scaling group is also affected by the value of the MultiAZPolicy parameter. For more information, see the Configure a combination policy for removing instances topic.
stringNo

The instance removal policy. Valid values:

  • OldestInstance: removes ECS instances that are added at the earliest point in time to the scaling group.
  • NewestInstance: removes ECS instances that are most recently added to the scaling group.
  • OldestScalingConfiguration: removes ECS instances that are created based on the earliest scaling configuration.
  • CustomPolicy: removes ECS instances based on the custom scale-in policy (Function).

The scaling configuration source specified by the OldestScalingConfiguration setting can be a scaling configuration or a launch template. The CustomPolicy setting takes effect only if you specify it as the first step to remove instances. If you specify CustomPolicy, you must also specify the CustomPolicyARN parameter.

Note The removal of ECS instances from a scaling group is also affected by the value of the MultiAZPolicy parameter. For more information, see the Configure a combination policy for removing instances topic.
OldestScalingConfiguration
VSwitchIdstringNo

The ID of the vSwitch. If you specify the VSwitchId parameter, the network type of the scaling group is VPC.

Note If you do not specify the VSwitchId or VSwitchIds parameter, the network type of the scaling group is classic network.
vsw-bp14zolna43z266bq****
MultiAZPolicystringNo

The scaling policy for ECS instances in the multi-zone scaling group. Valid values:

  • PRIORITY: scale ECS instances based on the priority of the vSwitches specified by VSwitchIds. Auto Scaling preferentially scales instances in the zone where the vSwitch of the highest priority resides. If the scaling fails, Auto Scaling scales instances in the zone where the vSwitch of the next highest priority resides.

  • COST_OPTIMIZED: create ECS instances that have the lowest unit price of vCPUs during scale-out events and removes ECS instances that have the highest unit price of vCPUs during scale-in events. If you specify preemptible instance types in your scaling configuration, Auto Scaling will preferentially create preemptible instances. You can also specify CompensateWithOnDemand to allow Auto Scaling to create pay-as-you-go instances in the case that preemptible instances cannot be created due to limited stock.

    **

    Note The COST_OPTIMIZED setting takes effect only when your scaling configuration contains multiple instance types or specifically contains preemptible instance types.

  • BALANCE: evenly distribute ECS instances across the zones that are specified for the scaling group. If ECS instances are unevenly distributed across the specified zones due to insufficient inventory, you can call the RebalanceInstance operation to evenly distribute the instances across the zones.

    **

    Note When you set MultiAZPolicy to BALANCE, this setting has an equivalent effect to setting MultiAZPolicy to COMPOSABLE and enabling AzBalance to true.

  • COMPOSABLE: combine the preceding policies into a custom scaling policy based on your business requirements. Alternatively, you can specify custom parameters to finely control the capacity of the scaling group.

Default value: PRIORITY.

PRIORITY
HealthCheckTypestringNo

The health check mode of the scaling group. Valid values:

  • NONE: Auto Scaling does not check the health status of instances.
  • ECS: Auto Scaling checks the health status of instances in the scaling group. If you want to enable instance health check, you can set the value to ECS, regardless of whether the scaling group is of ECS type or Elastic Container Instance type.
  • LOAD_BALANCER: Auto Scaling checks the health status of instances in the scaling group based on the health check results of load balancers. The health check results of Classic Load Balancer (CLB) instances are not supported as the health check basis for instances in the scaling group.

Default value: ECS.

Note If you want to enable instance health check and load balancer health check at the same time, we recommend that you specify HealthCheckTypes.
ECS
ScalingPolicystringNo

The reclaim mode of the scaling group. Valid values:

  • recycle: the economical mode

  • release: the release mode

  • forcerelease: the forced release mode

    **

    Note If you set the value to forcerelease, Auto Scaling will forcibly release the ECS instances that are in the Running state during the scale-out events. Forced release equates to an immediate power-off, resulting in the irreversible deletion of all ephemeral data stored on the instance. Once executed, this action cannot be undone and the lost data cannot be recovered. Exercise caution when you select this option.

  • forcerecycle: the forced recycle mode

    **

    Note If you set the value to forcerecycle, Auto Scaling will forcibly shut down the ECS instances that are in the Running state during the scale-out events. Forced recycle equates to an immediate power-off, resulting in the irreversible deletion of all ephemeral data stored on the instance. Once executed, this action cannot be undone and the lost data cannot be recovered. Exercise caution when you select this option.

ScalingPolicy specifies the reclaim mode of the scaling group. RemovePolicy of the RemoveInstances operation specifies the specific instance removal action. For more information, see RemoveInstances .

recycle
ClientTokenstringNo

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see Ensure idempotence.

123e4567-e89b-12d3-a456-42665544****
OnDemandBaseCapacityintegerNo

The minimum number of pay-as-you-go instances that must be contained 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.

30
OnDemandPercentageAboveBaseCapacityintegerNo

The 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.

20
SpotInstanceRemedybooleanNo

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 which indicates that the preemptible instance is to be reclaimed.

true
CompensateWithOnDemandbooleanNo

Specifies whether to automatically create pay-as-you-go instances to meet the requirement on the number of ECS instances when the expected capacity of preemptible instances cannot be provided due to reasons such as cost-related issues and insufficient resources. This parameter is available only if you set the MultiAZPolicy parameter to COST_OPTIMIZED. Valid values:

  • true
  • false

Default value: true.

true
SpotInstancePoolsintegerNo

The number of available instance types. Auto Scaling evenly creates preemptible instances of multiple instance types that are provided at the lowest cost in the scaling group. Valid values: 1 to 10.

5
DesiredCapacityintegerNo

The expected number of ECS instances in the scaling group. Auto Scaling automatically maintains the specified expected number of ECS instances. The DesiredCapacity value cannot be greater than the MaxSize value or less than the MinSize value.

5
GroupDeletionProtectionbooleanNo

Specifies whether to enable deletion protection for the scaling group. Valid values:

  • true: enables deletion protection for the scaling group. This way, the scaling group cannot be deleted.
  • false: disables deletion protection for the scaling group.

Default value: false.

true
GroupTypestringNo

The type of the instances that are managed by the scaling group. Valid values:

  • ECS: ECS instances.
  • ECI: elastic container instances.

Default value: ECS.

ECS
ContainerGroupIdstringNo

The ID of the elastic container instance.

eci-uf6fonnghi50u374****
VSwitchIdsarrayNo

The IDs of the vSwitches. If you specify VSwitchIds, VSwitchId is ignored. If you specify VSwitchIds, the network type of the scaling group is VPC.

If you specify multiple vSwitches, take note of the following items:

  • The vSwitches must belong to the same VPC.
  • The vSwitches can belong to different zones.
  • vSwitches are sorted in ascending order based on their priorities. The first vSwitch has the highest priority. If Auto Scaling fails to create ECS instances in the zone where the vSwitch of the highest priority resides, Auto Scaling attempts to create ECS instances in the zone where the vSwitch of the next highest priority resides.
Note If you do not specify VSwitchId or VSwitchIds for your scaling group, the network type of the scaling group is classic network.
stringNo

The ID of the vSwitch. If you specify VSwitchIds, VSwitchId is ignored. If you specify VSwitchIds, the network type of the scaling group is VPC.

If you specify multiple vSwitches, take note of the following items:

  • The vSwitches must belong to the same VPC.
  • The vSwitches can belong to different zones.
  • vSwitches are sorted in ascending order based on their priorities. The first vSwitch has the highest priority. If Auto Scaling fails to create ECS instances in the zone where the vSwitch of the highest priority resides, Auto Scaling attempts to create ECS instances in the zone where the vSwitch of the next highest priority resides.
Note If you do not specify VSwitchId or VSwitchIds for your scaling group, the network type of the scaling group is classic network.
vsw-bp14zolna43z266bq****
LifecycleHooksarray<object>No

The lifecycle hooks.

objectNo

The lifecycle hook.

DefaultResultstringNo

The action that Auto Scaling performs when the lifecycle hook times out. Valid values:

  • CONTINUE: Auto Scaling continues to respond to the scaling request.
  • ABANDON: Auto Scaling releases ECS instances that are created during scale-out events, or removes ECS instances from the scaling group during scale-in events.

If multiple lifecycle hooks in the scaling group are triggered during scale-in events, and you set DefaultResult to ABANDON for one of the lifecycle hooks, Auto Scaling immediately performs the action after the lifecycle hook whose DefaultResult is set to ABANDON times out. In this case, other lifecycle hooks time out ahead of schedule. In other cases, Auto Scaling performs the action only after all lifecycle hooks time out. The action that Auto Scaling performs is determined by the value of DefaultResult that you specify for the lifecycle hook that most recently times out.

Default value: CONTINUE.

CONTINUE
LifecycleHookNamestringNo

The name of the lifecycle hook. After you specify this parameter, you cannot change the name of the lifecycle hook. If you do not specify this parameter, the name of the lifecycle hook is the same as the ID of the lifecycle hook.

lifecyclehook****
LifecycleTransitionstringNo

The type of the scaling activity to which you want to apply the lifecycle hook. Valid values:

  • SCALE_OUT
  • SCALE_IN
Note If you specify lifecycle hooks for the scaling group, you must specify LifecycleTransition. Other parameters are optional.
SCALE_OUT
NotificationMetadatastringNo

The fixed string that you want to include in notifications. When a lifecycle hook takes effect, Auto Scaling sends a notification. The fixed string can contain up to 4,096 characters in length. When Auto Scaling sends a notification to the recipient party, it includes predefined notification metadata into the notification. This helps in managing and labeling notifications of different categories. NotificationMetadata takes effect only if you specify NotificationArn.

Test
NotificationArnstringNo

The Alibaba Cloud Resource Name (ARN) of the notification recipient party. You can specify a Simple Message Queue (SMQ, formerly MNS) topic or queue as the recipient party. The value is in the acs:ess:{region}:{account-id}:{resource-relative-id} format.

  • region: the region ID of the scaling group
  • account-id: the ID of your Alibaba Cloud account.

Examples:

  • SMQ queue: acs:ess:{region}:{account-id}:queue/{queuename}
  • SMQ topic: acs:ess:{region}:{account-id}:topic/{topicname}
acs:ess:cn-hangzhou:1111111111:queue/queue2
HeartbeatTimeoutintegerNo

The period of time before the lifecycle hook times out. When the lifecycle hook times out, Auto Scaling performs the action that is specified by DefaultResult. Valid values: 30 to 21600. Unit: seconds.

After you create a lifecycle hook, you can call the RecordLifecycleActionHeartbeat operation to extend the timeout period of the lifecycle hook. You can also call the CompleteLifecycleAction operation to end the timeout period of the lifecycle hook ahead of schedule.

Default value: 600.

600
VServerGroupsarray<object>No

The backend vServer group that you want to associate with the scaling group.

objectNo

Details of the backend vServer group that you want to associate with the scaling group.

VServerGroupAttributesarray<object>No

The attributes of the backend vServer group.

objectNo

The attributes of the backend vServer group.

VServerGroupIdstringNo

The ID of the vServer group.

rsp-bp1443g77****
WeightintegerNo

The weight of each ECS instance as a backend server in the vServer group. If you increase the weight for an ECS instance, the number of requests that are forwarded to the ECS instance also increases. If you set the weight for an ECS instance to 0, no requests are forwarded to the ECS instance. Valid values: 0 to 100.

Default value: 50.

100
PortintegerNo

The port number used by each ECS instance as a backend server in the vServer group. Valid values: 1 to 65535.

22
LoadBalancerIdstringNo

The ID of the CLB instance to which the backend vServer group belongs.

lb-bp1u7etiogg38yvwz****
Tagsarray<object>No

The tags that you want to add to the scaling group.

objectNo

The tag that you want to add to the scaling group.

KeystringNo

The tag key.

Department
ValuestringNo

The tag value.

Finance
PropagatebooleanNo

Specifies whether to propagate the tag that you want to add. Valid values:

  • true: propagates the tag to new instances.
  • false: does not propagate the tag to any instance.

Default value: false.

false
LaunchTemplateOverridesarray<object>No

Details of the instance types that you specify by using the Extended Configurations feature of the launch template.

objectNo

Details of the instance type that you specify by using the Extended Configurations feature of the launch template.

InstanceTypestringNo

The instance type that you want to use to override the instance type that is specified in the launch template.

If you want to scale instances based on the weighted capacities of the instances, you must specify both the InstanceType and WeightedCapacity parameters.

Note This parameter is available only if you specify the LaunchTemplateId parameter.

You can use the InstanceType parameter to specify only instance types that are available for purchase.

ecs.c5.xlarge
WeightedCapacityintegerNo

The weight of the instance type. The weight specifies the capacity of an instance of the specified instance type in the scaling group. If you want to scale instances based on the weighted capacities of the 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 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:

  • Current capacity: 0
  • Expected capacity: 6
  • Capacity of ecs.c5.xlarge: 4

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 types.

Valid values of the WeightedCapacity parameter: 1 to 500.

4
SpotPriceLimitfloatNo

The maximum bid price of the instance type that is specified by the InstanceType parameter. You can specify 1 to 10 instance types by using the Extended Configurations feature of the launch template.

Note This parameter is available only if you specify the LaunchTemplateId parameter.
0.025
AlbServerGroupsarray<object>No

The Application Load Balancer (ALB) server groups.

objectNo

Details of the ALB server group that you want to associate with the scaling group.

AlbServerGroupIdstringNo

The ID of the ALB server group.

You can attach only a limited number of ALB server groups to a scaling group. To view the predefined quota limit or manually request a quota increase, go to Quota Center.

sgp-ddwb0y0g6y9bjm****
WeightintegerNo

The weight of an ECS instance as a backend server in the ALB server group. If you increase the weight for an ECS instance, the number of requests that are forwarded to the ECS instance also increases. If you set the weight for an ECS instance to 0, no requests are forwarded to the ECS instance. Valid values: 0 to 100.

100
PortintegerNo

The port number used by each ECS instance as a backend server in the ALB server group. Valid values: 1 to 65535.

22
ServerGroupsarray<object>No

The server groups.

Note You cannot use AlbServerGroups and ServerGroups to specify the same server group.
objectNo

Details of the server group.

ServerGroupIdstringNo

The ID of the server group.

sgp-5yc3bd9lfyh*****
TypestringNo

The type of the server group. Valid values:

  • ALB
  • NLB
ALB
WeightintegerNo

The weight of each ECS instance as a backend server in the server group. Valid values: 0 to 100.

If you increase the weight for an ECS instance, the number of requests that are forwarded to the ECS instance also increases. If you set the weight for an ECS instance to 0, no requests are forwarded to the ECS instance.

100
PortintegerNo

The port number used by each ECS instance as backend server in the vServer group. Valid values: 1 to 65535.

22
AzBalancebooleanNo

Specifies whether to evenly distribute instances in the scaling group across multiple zones. This parameter takes effect only if you set MultiAZPolicy to COMPOSABLE. Valid values:

  • true
  • false
Note If you set MultiAZPolicy to COMPOSABLE and enable AzBalance to true, this setting has an equivalent effect to setting MultiAZPolicy to BALANCE.

Default value: false.

false
AllocationStrategystringNo

The allocation policy of instances. 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. This parameter takes effect only when you set the MultiAZPolicy parameter to COMPOSABLE. Valid values:

  • priority: Auto Scaling selects instance types based on the specified order of the instance types to create the required number of instances.
  • lowestPrice: Auto Scaling selects instance types that have the lowest unit price of vCPUs to create the required number of instances.

Default value: priority.

priority
SpotAllocationStrategystringNo

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 if you set the MultiAZPolicy parameter to COMPOSABLE. Valid values:

  • priority: Auto Scaling selects instance types based on the specified order of the instance types to create the required number of preemptible instances.
  • lowestPrice: Auto Scaling selects instance types that have the lowest unit price of vCPUs to create the required number of preemptible instances.

Default value: priority.

lowestPrice
SyncAlarmRuleToCmsbooleanNo
Note This parameter is unavailable.
false
MaxInstanceLifetimeintegerNo

The maximum life span of an instance in the scaling group. Unit: seconds.

Valid values: 86400 to the value of the Integer.maxValue parameter.

Default value: null.

null
CustomPolicyARNstringNo

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 to remove instances.

acs:fc:cn-zhangjiakou:16145688****:services/ess_custom_terminate_policy.LATEST/functions/ess_custom_terminate_policy_name
ResourceGroupIdstringNo

The ID of the resource group to which you want to add the scaling group.

Note If you specify this parameter, new scaling groups are added to the specified resource group. If you do not specify this parameter, new scaling groups are added to the default resource group.
rg-123******
LoadBalancerConfigsarray<object>No

The load balancer configurations.

objectNo

The CLB instance configurations.

LoadBalancerIdstringNo

The ID of the CLB instance.

lb-2zen1olhfg9yw3f4qgte4
WeightintegerNo

The weight of each ECS instance as a backend server in the CLB backend server group. If you increase the weight for an ECS instance, the number of requests that are forwarded to the ECS instance also increases. If you set the weight for an ECS instance to 0, no requests are forwarded to the ECS instance. Valid values: 0 to 100.

10
HealthCheckTypesarrayNo

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.
stringNo

The health check modes of the scaling group. Valid values:

  • NONE: Auto Scaling does not check the health status of instances.
  • ECS: Auto Scaling checks the health status of instances in the scaling group. If you want to enable instance health check, you can set the value to ECS, regardless of whether the scaling group is of ECS type or Elastic Container Instance type.
  • LOAD_BALANCER: Auto Scaling checks the health status of instances based on the health check results of load balancers. The health check results of CLB instances are not supported as the health check basis for instances in the scaling group.

Default value: ECS.

ECS
DBInstancesarray<object>No

The databases that you want to attach to the scaling group.

objectNo
DBInstanceIdstringNo

The database ID.

rm-m5eqju85s45mu0***
TypestringNo

The database type. Valid values:

  • RDS
  • Redis
  • MongoDB

Default value: RDS.

RDS
AttachModestringNo

The mode in which you want to attach the database to the scaling group. Valid values:

  • SecurityIp: the mode in which Auto Scaling automatically adds the private IP addresses of ECS instances to the IP address whitelist of the database during scale-out events. You can set the value to SecurityIp only if you set Type to RDS.
  • SecurityGroup: the mode in which Auto Scaling adds the security group of the applied scaling configuration to the security group whitelist of the database. This setting allows ECS instances created from the scaling configuration to access the database.
SecurityIp
StopInstanceTimeoutintegerNo

The period of time required by the ECS instance to enter the Stopped state. Unit: seconds. Valid values: 30 to 240.

Note
  • This parameter takes effect only if you set ScalingPolicy to release.

  • If you specify this parameter, the system will wait for the ECS instance to enter the Stopped state for the specified period of time before continuing with the scale-in operation, regardless of the status of the ECS instance.

  • If you do not specify this parameter, the system will wait for the ECS instance to stop before continuing with the scale-in operation. If the ECS instance is not successfully stopped, the scale-in process will be rolled back and considered failed.

60
CapacityOptionsobjectNo

The capacity options.

OnDemandBaseCapacityintegerNo

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 MultiAZPolicy to COMPOSABLE, the default value is 0.

30
OnDemandPercentageAboveBaseCapacityintegerNo

The percentage of pay-as-you-go instances in the excess instances when the minimum number of pay-as-you-go instances is reached. OnDemandBaseCapacity specifies the minimum number of pay-as-you-go instances that must be contained in the scaling group. Valid values: 0 to 100.

If you set MultiAZPolicy to COMPOSABLE, the default value is 100.

20
CompensateWithOnDemandbooleanNo

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 inventory of resources. This parameter takes effect when you set MultiAZPolicy to COST_OPTIMIZED. Valid values:

  • true
  • false

Default value: true.

true
SpotAutoReplaceOnDemandbooleanNo

Specifies whether to replace pay-as-you-go instances with preemptible instances. If you specify CompensateWithOnDemand, it may result in a higher percentage of pay-as-you-go instances compared to the value of OnDemandPercentageAboveBaseCapacity. In this scenario, Auto Scaling will try to deploy preemptible instances to replace the surplus pay-as-you-go instances. When CompensateWithOnDemand is specified, Auto Scaling creates pay-as-you-go instances if there are not enough preemptible instance types. To avoid keeping these pay-as-you-go ECS instances for long periods, Auto Scaling tries to replace them with preemptible instances as soon as enough of preemptible instance types become available. Valid values:

  • true
  • false

Default value: false.

false

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****
ScalingGroupIdstring

The ID of the scaling group.

asg-bp14wlu85wrpchm0****

Examples

Sample success responses

JSONformat

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
  "ScalingGroupId": "asg-bp14wlu85wrpchm0****"
}

Error codes

HTTP status codeError codeError message
404ResourceNotAvailable.VPCNetworkThe specified zone does not support vpc network or sold out.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-12-03The Error code has changed. The request parameters of the API has changedView Change Details
2024-10-16The Error code has changed. The request parameters of the API has changedView Change Details
2024-04-23The Error code has changed. The request parameters of the API has changedView Change Details
2024-02-01The Error code has changed. The request parameters of the API has changedView Change Details
2023-11-14The Error code has changedView Change Details
2023-03-30The Error code has changed. The request parameters of the API has changedView Change Details
2022-12-22The Error code has changedView Change Details