All Products
Search
Document Center

Auto Scaling:CreateScalingGroup

Last Updated:Sep 17, 2026

Creates a scaling group to automatically adjust your compute capacity (the number of instances) based on business changes and policies if you need to automatically increase or decrease the number of instances of a specified type.

Operation description

A scaling group is a collection of ECS instances that serve the same common scenarios.

The number of scaling groups that can be created in a region is related to your Auto Scaling usage. Go to Quota Center to view the quota value for the total number of scaling groups.

A scaling group does not take effect immediately after it is created. You must call the EnableScalingGroup operation to enable the scaling group before it can trigger scaling activities and execute scaling rules.

The scaling group, the associated Classic Load Balancer (CLB, formerly SLB) instances, and the associated ApsaraDB RDS instances must be in the same region. For more information, see Regions and zones.

If you associate a CLB instance with the scaling group, the scaling group automatically adds ECS instances that join the scaling group to the backend server group of the CLB instance. You can specify the server groups to which ECS instances are added. The following two types of server groups are supported:

  • Default server group: used to accept frontend requests. If no virtual server group or primary/secondary server group is configured for a listener, requests are forwarded to the ECS instances in the default server group by default.

  • Virtual service group: use a virtual service group when you want to forward different requests to different backend servers, or when you want to forward requests based on domain names or URLs.

Note

If you specify both the default server group and multiple virtual service groups, the ECS instances are added to all of these server groups.

After an instance is added to the backend server group of a CLB instance, the weight of the instance is set to 50 by default. The CLB instance must meet the following conditions:

  • The CLB instance must be in the active state. You can call the DescribeLoadBalancers operation to query the status of the specified CLB instance.

  • Health checks must be enabled for all listener ports configured on the CLB instance. Otherwise, the scaling group fails to be created.

If you associate an Application Load Balancer (ALB) server group, Network Load Balancer (NLB) server group, or Gateway Load Balancer (GWLB) server group with the scaling group, the scaling group automatically adds ECS instances that join the scaling group as backend servers of the ALB, NLB, or GWLB server group to process access requests distributed by the ALB, NLB, or GWLB instance. You can specify multiple ALB, NLB, or GWLB server groups, but the server groups must belong to the same VPC as the scaling group. For more information, see AttachAlbServerGroups or AttachServerGroups.

If you associate an ApsaraDB RDS instance with the scaling group, the scaling group automatically adds the internal IP addresses of ECS instances that join the scaling group to the whitelist of the ApsaraDB RDS instance. The ApsaraDB RDS instance must meet the following conditions:

  • The ApsaraDB RDS instance must be in the Running state. You can call the DescribeDBInstances operation to query the status of the specified ApsaraDB RDS instance.

  • The number of IP addresses in the whitelist of the ApsaraDB RDS instance must not exceed the upper limit. For more information, see Configure a whitelist in the ApsaraDB RDS documentation.

If MultiAZPolicy of the scaling group is set to COST_OPTIMIZED:

  • When you specify the OnDemandBaseCapacity, OnDemandPercentageAboveBaseCapacity, and SpotInstancePools parameters, the instance allocation method under the cost optimization policy is specified, and this allocation method is prioritized during scale-out and scale-in events.

  • When you do not specify the OnDemandBaseCapacity, OnDemandPercentageAboveBaseCapacity, or SpotInstancePools parameters, the cost optimization policy creates instances only in the most cost-effective manner. (In this mode, instances cannot be created by using elasticity assurance or capacity reservation. The vSwitch parameter of secondary network interface controllers (NICs) is not supported.)

If you set propagable tags for the scaling group, that is, Tags.Propagate is set to true:

  • Tags on the scaling group are propagated only to newly created instances, not to instances that are already running in the scaling group.

  • If you specify instance tags in the scaling configuration and choose to propagate the scaling group tags to the instance, all tags coexist.

  • If a propagable tag on the scaling group and a tag in the scaling configuration have the same tag key, the tag value in the scaling configuration takes precedence.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ess:CreateScalingGroup

create

*ScalingGroup

acs:ess:{#regionId}:{#accountId}:scalinggroup/*

None None

Request parameters

Parameter

Type

Required

Description

Example

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 letters, digits, underscores (_), hyphens (-), and periods (.). It must start with a digit, letter, or Chinese character.

Default value: the value of ScalingGroupId.

scalinggroup****

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:

  • A fixed template version number.

  • Default: always uses the default template version.

  • Latest: always uses the latest template version.

Default

InstanceId

string

No

The instance ID. When you create a scaling group, the required configuration information is obtained from the specified instance, and a scaling configuration is automatically created.

i-28wt4****

RegionId

string

Yes

The region ID of the scaling group. For more information, see Regions and zones.

cn-qingdao

MinSize

integer

Yes

The minimum number of instances in the scaling group. When the number of instances in the scaling group is less than the value of MinSize, Auto Scaling automatically creates instances.

Note

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

2

MaxSize

integer

Yes

The maximum number of instances in the scaling group. When the number of instances in the scaling group is greater than the value of MaxSize, Auto Scaling automatically removes instances.

The valid values of MaxSize are related to your Auto Scaling usage. Go to Quota Center to view the quota value for Maximum number of instances in a scaling group.

If the quota value for Maximum number of instances in a scaling group is 2000, the valid values of MaxSize are 0 to 2000.

20

DefaultCooldown

integer

No

The cooldown time after a scaling activity (adding or removing instances) is complete. Valid values: 0 to 86400. Unit: seconds.

During the cooldown time, the scaling group does not execute other scaling activities. This restriction applies only to scaling activities triggered by CloudMonitor event-triggered tasks.

Default value: 300.

300

LoadBalancerIds

string

No

The IDs of CLB (formerly SLB) instances. The value can be a JSON array that consists of multiple CLB instance IDs. Separate the IDs with commas (,).

The total number of CLB instances that can be associated with a single scaling group is related to your Auto Scaling usage. Go to Quota Center to view the quota value for Total number of load balancing instances that can be associated with a scaling group.

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

DBInstanceIds

string

No

The IDs of ApsaraDB RDS instances. The value can be a JSON array that consists of multiple ApsaraDB RDS instance IDs. Separate the IDs with commas (,).

The total number of ApsaraDB RDS instances that can be associated with a single scaling group is related to your Auto Scaling usage. Go to Quota Center to view the quota value for Total number of RDS instances that can be associated with a scaling group.

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

RemovalPolicy.1

string

No

The first-round filter strategy for the scale-in policy. This parameter cannot have the same value as RemovalPolicy.2 or RemovalPolicy.3. Valid values:

  • OldestInstance: removes the ECS instance that was earliest added to the scaling group.

  • NewestInstance: removes the ECS instance that was most recently added to the scaling group.

  • OldestScalingConfiguration: removes the ECS instance that was created from the earliest scaling configuration.

  • CustomPolicy: removes ECS instances based on a custom scale-in policy (Function).

The scaling configuration mentioned in OldestScalingConfiguration refers to the instance configuration source in the scaling group, including scaling configurations and launch templates. CustomPolicy can be set only as the first-round scale-in policy. When 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 scaling policy (MultiAZPolicy) of the scaling group. For more information, see Configure a combination policy for removing instances.

OldestScalingConfiguration

RemovalPolicy.2

string

No

The second-round filter strategy for the scale-in policy. This parameter cannot have the same value as RemovalPolicy.1 or RemovalPolicy.3. Valid values:

  • OldestInstance: removes the ECS instance that was earliest added to the scaling group.

  • NewestInstance: removes the ECS instance that was most recently added to the scaling group.

  • OldestScalingConfiguration: removes the ECS instance that was created from the earliest scaling configuration.

Note

The removal of ECS instances from a scaling group is also affected by the scaling policy (MultiAZPolicy) of the scaling group. For more information, see Configure a combination policy for removing instances.

OldestInstance

RemovalPolicy.3

string

No

The third-round filter strategy for the scale-in policy. This parameter cannot have the same value as RemovalPolicy.1 or RemovalPolicy.2. Valid values:

  • OldestInstance: removes the ECS instance that was earliest added to the scaling group.

  • NewestInstance: removes the ECS instance that was most recently added to the scaling group.

  • OldestScalingConfiguration: removes the ECS instance that was created from the earliest scaling configuration.

Note

The removal of ECS instances from a scaling group is also affected by the scaling policy (MultiAZPolicy) of the scaling group. For more information, see Configure a combination policy for removing instances.

NewestInstance

VSwitchId

string

No

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

Note

If neither VSwitchId nor VSwitchIds.N is specified for the scaling group, the network type of the scaling group defaults to classic network.

vsw-bp14zolna43z266bq****

MultiAZPolicy

string

No

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

  • PRIORITY: the vSwitch specified first (VSwitchIds.N) has the highest priority. Auto Scaling preferentially attempts to scale instances in the zone of the highest-priority vSwitch. If the scaling cannot be completed, Auto Scaling automatically attempts to scale instances in the zone of the next-priority vSwitch.

  • COST_OPTIMIZED: during scale-out events, Auto Scaling attempts to create ECS instances in ascending order of vCPU unit price. During scale-in events, Auto Scaling attempts to remove ECS instances in descending order of vCPU unit price. If the scaling configuration specifies preemptible billing methods with multiple instance types, spot instances are preferentially created. You can use the CompensateWithOnDemand parameter to specify whether to automatically create pay-as-you-go instances when spot instances cannot be created due to insufficient inventory or other reasons.

    Note

    COST_OPTIMIZED takes effect only when the scaling configuration specifies multiple instance types or uses spot instances.

  • BALANCE: ECS instances are evenly allocated across the multiple zones specified for the scaling group. If instances become unbalanced across zones due to insufficient inventory or other reasons, you can call the RebalanceInstance operation to rebalance resources.

  • COMPOSABLE: is a composable policy that allows you to combine the preceding multi-zone scaling policies for ECS instances. You can also specify additional parameters for more fine-grained control over the capacity of the scaling group.

Default value: PRIORITY.

PRIORITY

HealthCheckType

string

No

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

  • NONE: no health check is performed.

  • ECS: health checks are performed on instances in the scaling group. (Both ECS-type and ECI-type scaling groups use this value to enable instance health checks.)

  • LOAD_BALANCER: the instance health status is determined based on load balancing health check results. (CLB-type load balancing is not supported.)

Default value: ECS.

Note

To enable both instance health checks and load balancing health checks, use the HealthCheckTypes parameter.

ECS

ScalingPolicy

string

No

The reclaim mode of the scaling group. Valid values:

  • recycle: the scaling group uses the shutdown and reclaim mode.

  • release: the scaling group uses the release mode.

  • forcerelease: the scaling group uses the forced release mode.

    Note

    If you select forcerelease, running instances are forcefully released during scale-in activities. A forced release is equivalent to a power-off operation, which erases temporary data in the memory and storage of the instance. The data cannot be recovered. Proceed with caution.

  • forcerecycle: the scaling group uses the forced shutdown and reclaim mode.

    Note

    If you select forcerecycle, running instances are forcefully shut down during scale-in activities. A forced shutdown is equivalent to a power-off operation, which erases temporary data in the memory and storage of the instance. The data cannot be recovered. Proceed with caution.

ScalingPolicy specifies the reclaim mode of the scaling group. However, the specific action taken when an instance is removed from the scaling group is determined by the RemovePolicy parameter of RemoveInstances. For more information, see RemoveInstances.

recycle

ClientToken

string

No

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

Generate a value from your client that is unique among different requests. The value can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

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

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

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

20

SpotInstanceRemedy

boolean

No

Specifies whether to supplement spot instances. If this feature is enabled, Auto Scaling attempts to create a new instance to replace a spot instance when the system sends a notification that the spot 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 spot instances cannot be created due to price or inventory reasons. This parameter takes effect only when MultiAZPolicy is set to COST_OPTIMIZED. Valid values:

  • true: allows automatic creation.

  • false: does not allow automatic creation.

Default value: true.

true

SpotInstancePools

integer

No

The number of available instance types. Auto Scaling evenly creates spot instances of multiple types that offer the lowest cost. Valid values: 1 to 10.

When the MultiAZPolicy parameter is set to COMPOSABLE, the default value is 2.

5

DesiredCapacity

integer

No

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

5

GroupDeletionProtection

boolean

No

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

  • true: enables deletion protection. The scaling group cannot be deleted.

  • false: disables deletion protection.

Default value: false.

true

GroupType

string

No

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

  • ECS: the scaling group manages ECS instances.

  • ECI: the scaling group manages Elastic Container Instance (ECI) instances.

Default value: ECS.

ECS

ContainerGroupId

string

No

The instance ID of the ECI instance, which is the container group ID.

eci-uf6fonnghi50u374****

VSwitchIds

array

No

The IDs of one or more vSwitches. If you specify the VSwitchIds parameter, the VSwitchId parameter is ignored. If you specify this parameter, the network type of the scaling group is VPC.

When you specify multiple vSwitches:

  • The vSwitches must belong to the same VPC.

  • The vSwitches can belong to different zones.

  • The priority of vSwitches is determined 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, the next-priority vSwitch is automatically selected.

Note

If neither VSwitchId nor VSwitchIds is specified for the scaling group, the network type of the scaling group defaults to classic network.

vsw-bp14zolna43z266bq****

string

No

The IDs of one or more vSwitches. If you specify the VSwitchIds.N parameter, the VSwitchId parameter is ignored. If you specify this parameter, the network type of the scaling group is VPC.

When you specify multiple vSwitches:

  • The vSwitches must belong to the same VPC.

  • The vSwitches can belong to different zones.

  • The priority of vSwitches is determined 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, the next-priority vSwitch is automatically selected.

Note

If neither VSwitchId nor VSwitchIds.N is specified for the scaling group, the network type of the scaling group defaults to classic network.

vsw-bp14zolna43z266bq****

LifecycleHook

array<object>

No

The lifecycle hook information.

object

No

The lifecycle hook information.

DefaultResult

string

No

The action to take after the wait state ends. Valid values:

  • CONTINUE: continues to respond to the scale-out or scale-in event.

  • ABANDON: releases the ECS instance created during the scale-out event, or directly removes the ECS instance from the scaling group during the scale-in event.

When a scale-in event (SCALE_IN) occurs in the scaling group and triggers multiple lifecycle hooks, if the wait state of a lifecycle hook with DefaultResult set to ABANDON ends, the wait states of other corresponding lifecycle hooks end early. In other cases, the action is determined by the last lifecycle hook whose wait state ends.

Default value: CONTINUE.

CONTINUE

LifecycleHookName

string

No

The name of the lifecycle hook. After the name is specified, it cannot be modified. If not specified, the name defaults to the lifecycle hook ID.

lifecyclehook****

LifecycleTransition

string

No

The type of scaling activity to which the lifecycle hook applies. Valid values:

  • SCALE_OUT: scale-out events of the scaling group.

  • SCALE_IN: scale-in events of the scaling group.

Note

If lifecycle hooks are specified for the scaling group, this parameter is required. Other related parameters are optional.

SCALE_OUT

NotificationMetadata

string

No

The fixed string information for the wait state of the scaling activity. The parameter value cannot exceed 128 characters in length. Each time Auto Scaling pushes a message to the Notification Recipient, it also sends the NotificationMetadata parameter value that you specified, which helps you manage and mark different categories of notification information. This parameter takes effect only when the NotificationArn parameter is also specified.

Test

NotificationArn

string

No

The Notification Recipient identifier for the lifecycle hook. The following types of notification objects are supported: Simple Message Queue (formerly MNS) queues and topics. Specify the parameter value in the following format: acs:ess:{region}:{account-id}:{resource-relative-id}.

  • region: the region where the scaling group resides.

  • account-id: the Alibaba Cloud account ID.

Examples:

  • MNS queue: acs:ess:{region}:{account-id}:queue/{queuename}.

  • MNS topic: acs:ess:{region}:{account-id}:topic/{topicname}.

acs:ess:cn-hangzhou:1111111111:queue/queue2

HeartbeatTimeout

integer

No

The wait time set by the lifecycle hook for the scaling group activity. The next action is performed after the wait state times out. Valid values: 30 to 21600. Unit: seconds.

After a lifecycle hook is created, you can call RecordLifecycleActionHeartbeat to extend the wait time of the ECS instance, or call CompleteLifecycleAction to end the wait state of the scaling activity early.

Default value: 600.

600

VServerGroup

array<object>

No

The information about the virtual service groups associated with the scaling group.

array<object>

No

The information about the virtual service groups associated with the scaling group.

VServerGroupAttribute

array<object>

No

The attributes of the backend server group.

object

No

The attributes of the backend server group.

VServerGroupId

string

No

The ID of the virtual service group.

For more information, see AttachVServerGroups.

rsp-bp1443g77****

Weight

integer

No

The weight of the instance as a backend server after Auto Scaling adds the instance to the virtual service group. A higher weight indicates that the instance is allocated more access requests. If the weight is 0, the instance does not receive access requests. Valid values: 0 to 100. Default value: 50.

For more information, see AttachVServerGroups.

100

Port

integer

No

The port number used by the instance after Auto Scaling adds the instance to the virtual service group. Valid values: 1 to 65535.

For more information, see AttachVServerGroups.

22

LoadBalancerId

string

No

The ID of the CLB (formerly SLB) instance to which the virtual service group belongs.

For more information, see AttachVServerGroups.

lb-bp1u7etiogg38yvwz****

Tag

array<object>

No

The tags of the scaling group.

object

No

The tags of the scaling group.

Key

string

No

The tag key of the scaling group.

Department

Value

string

No

The tag value of the scaling group.

Finance

Propagate

boolean

No

Specifies whether the tag is a propagable tag. Valid values:

  • true: tags on the scaling group are propagated only to newly created instances, not to instances that are already running in the scaling group.

  • false: tags on the scaling group are not propagated to instances.

Default value: false.

false

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 and 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 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 performance metrics such as the number of vCPUs and memory size, you can assign different weights to different instance types based on your requirements.

Example:

  • Current capacity: 0.

  • Expected capacity: 6.

  • Capacity of ecs.c5.xlarge: 4.

To meet the expected capacity, the scaling group scales out 2 ecs.c5.xlarge instances.

Note

During scale-out events, 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 LaunchTemplateOverride.N.InstanceType. 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.

0.025

AlbServerGroup

array<object>

No

The information about ALB server groups.

object

No

The information about ALB server groups.

AlbServerGroupId

string

No

The ID of the ALB server group.

N specifies the number of the ALB server group. The number of ALB server groups that can be associated with a scaling group is limited. To view or request a quota increase, go to Quota Center.

sgp-ddwb0y0g6y9bjm****

Weight

integer

No

The weight of the instance as a backend server after Auto Scaling adds the instance to the ALB server group. A higher weight indicates that the instance receives more requests. If the weight is 0, the instance does not receive any requests. Valid values: 0 to 100.

N specifies the number of the ALB server group.

100

Port

integer

No

The port number used by the instance after Auto Scaling adds the instance to the ALB server group. Valid values: 1 to 65535.

N specifies the number of the ALB server group.

Note

If the values of N are the same but the values of Port are different, the system associates the ALB server group with the scaling group multiple times with different ports.

22

ServerGroup

array<object>

No

The information about load balancing server groups.

Note

You cannot set the same server group information in both AlbServerGroups and ServerGroups.

object

No

The information about load balancing server groups.

ServerGroupId

string

No

The ID of the server group.

sgp-5yc3bd9lfyh*****

Type

string

No

The type of the server group. Valid values:

  • ALB: Application Load Balancer (ALB).

  • NLB: Network Load Balancer (NLB).

  • GWLB: Gateway Load Balancer (GWLB).

ALB

Weight

integer

No

The weight of the instance as a backend server after Auto Scaling adds the instance to the server group. Valid values: 0 to 100.

A higher weight indicates that the instance is allocated more access requests. If the weight is 0, the instance does not receive access requests.

Note

This parameter is required for ALB and NLB load balancing server groups. You cannot set this parameter for GWLB load balancing server groups.

100

Port

integer

No

The port number used by the instance after Auto Scaling adds the instance to the server group. Valid values: 1 to 65535.

Note

This parameter is required for ALB and NLB load balancing server groups. You cannot set this parameter for GWLB load balancing server groups. The default value for GWLB is 6081.

22

AzBalance

boolean

No

Specifies whether to evenly distribute the capacity of the scaling group across multiple zones. This parameter takes effect only when MultiAZPolicy is set to COMPOSABLE. Valid values:

  • true: The capacity of the scaling group is evenly distributed across multiple zones.

  • false: The capacity of the scaling group is not evenly distributed across multiple zones.

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 capacity allocation strategy applies to both pay-as-you-go and spot capacities. This parameter takes effect only when MultiAZPolicy is set to COMPOSABLE. Valid values:

  • priority: Instances are created based on the order of configured instance types.

  • lowestPrice: Instances are created based on the unit vCPU price of instance types in ascending order.

Default value: priority.

priority

SpotAllocationStrategy

string

No

The allocation strategy for spot capacity. You can use this parameter to separately specify the allocation strategy for spot capacity. This parameter takes effect only when MultiAZPolicy is set to COMPOSABLE. Valid values:

  • priority: Instances are created based on the order of configured instance types.

  • lowestPrice: Instances are created based on the unit vCPU price of instance types in ascending order.

Default value: priority.

lowestPrice

MaxInstanceLifetime

integer

No

The maximum amount of time that an instance can exist in the scaling group. Unit: seconds.

Valid values: [86400, Integer.maxValue].

Default value: null.

Note

This parameter is not supported for scaling groups of the Elastic Container Instance (ECI) type or scaling groups with the economical mode enabled.

86400

CustomPolicyARN

string

No

The Alibaba Cloud Resource Name (ARN) of the China custom scale-in policy function. This parameter takes effect only when the first removal policy in RemovalPolicies is set to CustomPolicy.

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

ResourceGroupId

string

No

The ID of the resource group to which the scaling group belongs.

Note

The newly created scaling group is added to the specified resource group. If you do not specify this parameter, the scaling group is added to the default resource group.

rg-123****

LoadBalancerConfig

array<object>

No

The configurations of Classic Load Balancer (CLB, formerly SLB) instances.

object

No

The configurations of Classic Load Balancer (CLB, formerly SLB) instances.

LoadBalancerId

string

No

The ID of the Classic Load Balancer (CLB, formerly SLB) instance.

147b46d767c-cn-qingdao-cm5****

Weight

integer

No

The weight of the instance as a backend server after Auto Scaling adds the instance to the CLB (formerly SLB) server group. A higher weight indicates that the instance is allocated more access requests. If the weight is 0, the instance does not receive access requests.

Valid values: 0 to 100.

10

HealthCheckTypes

array

No

The health check modes of the scaling group.

Note

You can use this parameter to specify multiple health check modes. If the HealthCheckType parameter is specified, this parameter is ignored.

string

No

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

  • NONE: Health checks are disabled.

  • ECS: Health checks are performed on instances in the scaling group. This value applies to scaling groups of both the ECS type and the ECI type.

  • LOAD_BALANCER: The health status of instances is determined based on load balancing health check results. CLB-type load balancing is not supported.

Default value: ECS.

ECS

DBInstance

array<object>

No

The databases associated with the scaling group.

object

No

The configuration of databases associated with the scaling group.

DBInstanceId

string

No

The instance ID of the database.

rm-m5eqju85s45mu0***

Type

string

No

The type of the database. Valid values:

  • RDS.

  • Redis.

  • MongoDB.

Default value: RDS.

RDS

AttachMode

string

No

The mode in which the scaling group is associated with the database. Valid values:

  • SecurityIp: IP whitelist mode. Instances added during scale-out events are automatically added to the IP whitelist of the database. Only RDS databases are supported.

  • SecurityGroup: Security group mode. The security group specified in the scaling configuration is added to the security group whitelist of the database, which allows instances in the security group to access the database.

SecurityIp

StopInstanceTimeout

integer

No

The timeout period for waiting for an ECS instance to stop during a scale-in process. Unit: seconds. Valid values: 30 to 240.

Note
  • This parameter takes effect only during scale-in processes when ScalingPolicy is set to release.

  • If this parameter is specified, the system waits up to the StopInstanceTimeout period for the instance to stop. After the timeout, the scale-in process continues regardless of whether the instance has stopped.

  • If this parameter is not specified, the system waits indefinitely for the instance to stop. The scale-in process continues only after the instance stops. If the instance fails to stop, the scale-in process is rolled back and fails.

60

CapacityOptions

object

No

The capacity options.

OnDemandBaseCapacity

integer

No

The minimum number of pay-as-you-go instances required in the scaling group. If the number of pay-as-you-go instances in the scaling group is less than this value, the system preferentially creates pay-as-you-go instances. Valid values: 0 to 1000.

When MultiAZPolicy is set to COMPOSABLE, the default value is 0.

30

OnDemandPercentageAboveBaseCapacity

integer

No

The percentage of pay-as-you-go instances among the additional instances that exceed the OnDemandBaseCapacity value. Valid values: 0 to 100.

When MultiAZPolicy is set to COMPOSABLE, the default value is 100.

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 price or inventory reasons. This parameter takes effect only when MultiAZPolicy is set to COST_OPTIMIZED. Valid values:

  • true: allows automatic creation.

  • false: does not allow automatic creation.

Default value: true.

true

SpotAutoReplaceOnDemand

boolean

No

Specifies whether to use spot instances to replace pay-as-you-go instances when the pay-as-you-go ratio exceeds the OnDemandPercentageAboveBaseCapacity value after CompensateWithOnDemand is enabled. A common scenario is when spot instances are downgraded to pay-as-you-go instances due to spot inventory or pricing issues caused by CompensateWithOnDemand. To prevent pay-as-you-go instances from persisting for an extended period, the system attempts to replace excess pay-as-you-go capacity with spot instances. Valid values:

  • true: Allowed.

  • false: Not allowed.

Default value: false.

false

PriceComparisonMode

string

No

The price comparison mode for the cost optimization strategy of the scaling group. Valid values:

  • PricePerUnit: Compares prices based on the price per unit of capacity.

    The capacity of an instance in the scaling group equals the weight configured for the instance type. The default weight is 1, which means one ECS instance occupies a capacity of 1.

  • PricePerVCpu: Compares prices based on the price per vCPU.

Default value: PricePerUnit.

PricePerUnit

BalanceMode

string

No

The zone balance mode. This parameter takes effect only when zone balancing is enabled. Valid values:

  • BalancedBestEffort: If resource creation fails in a zone, the system falls back to other zones to ensure best-effort resource delivery.

  • BalancedOnly: If resource creation fails in a zone, the system does not fall back to other zones. The scaling activity partially succeeds to prevent excessive imbalance of resources across zones.

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:

  • false: Automatic rebalancing is disabled.

  • true: When automatic rebalancing is enabled, the scaling group automatically monitors the capacity across zones. If the capacity is imbalanced across zones, the scaling group proactively performs scale-out and scale-in operations to rebalance the capacity.

Default value: false.

false

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

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

ScalingGroupId

string

The scaling group ID.

asg-bp14wlu85wrpchm0****

Examples

Success response

JSON format

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

Error codes

HTTP status code

Error code

Error message

Description

404 ResourceNotAvailable.VPCNetwork The specified zone does not support vpc network or sold out.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.