CreateScalingGroup

Updated at:

Creates a scaling group to automatically adjust computing capacity by adding or removing instances of a specified type based on business requirements and policies.

Operation description

A scaling group is a collection of ECS instances that share the same Common scenarios.

The number of scaling groups that you can create in a region depends on your Auto Scaling usage. Go to Quota Center to check the quota for the total number of scaling groups.

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

The scaling group, the associated Classic load balancing (CLB) instances, and the associated ApsaraDB RDS instances must reside in the same region. For more information, see Regions and active zones.

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

  • Default server group: the ECS instances that accept frontend requests. If a listener does not have settings for a virtual service group or primary/secondary server group, requests are forwarded to the ECS instances in the default server group by default.

  • Virtual service group: the ECS instances to which different requests are forwarded. You can use virtual service groups when you need to forward different requests to different backend servers, or forward requests based on domain names and URLs.

Note

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

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

  • The CLB instance must be in the Active state. You can call the DescribeLoadBalancers operation to view the status of the CLB instance.

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

If you associate Application Load Balancer (ALB) server groups, Network Load Balancer (NLB) server groups, or Gateway Load Balancer (GWLB) server groups with the scaling group, Auto Scaling automatically adds the ECS instances in the scaling group as backend servers to the ALB, NLB, or GWLB server groups to process access requests distributed by the ALB, NLB, or GWLB instances. 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 ApsaraDB RDS instances with the scaling group, Auto Scaling automatically adds the internal IP addresses of the ECS instances in the scaling group to the whitelists of the ApsaraDB RDS instances. The ApsaraDB RDS instances must meet the following conditions:

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

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

If the MultiAZPolicy parameter of the scaling group is set to COST_OPTIMIZED:

  • If you specify the OnDemandBaseCapacity, OnDemandPercentageAboveBaseCapacity, and SpotInstancePools parameters, which define the instance allocation method under the cost optimization policy, the instance allocation method is prioritized during scale-out and scale-in.

  • If you do not specify the OnDemandBaseCapacity, OnDemandPercentageAboveBaseCapacity, or SpotInstancePools parameters, instances are created in the most cost-effective manner under the cost optimization policy. In this mode, you cannot create instances by using elasticity assurances or capacity reservations, and you cannot specify the vSwitch to which secondary elastic network interfaces (ENIs) belong.

If you configure propagatable tags for the scaling group, which means 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 tags of the scaling group to the instance, all tags coexist.

  • If a tag in the scaling configuration and a propagatable tag in the scaling group 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 digits, underscores (_), hyphens (-), and periods (.). It must start with a digit, a letter, or a Chinese character.

Default value: the value of ScalingGroupId.

scalinggroup****

LaunchTemplateId

string

No

The ID of the instance launch template. This parameter is used to specify the launch template from which the scaling group obtains launch configuration information.

lt-m5e3ofjr1zn1aw7****

LaunchTemplateVersion

string

No

The version of the instance launch template. Valid values:

  • A specific template version number.

  • Default: always uses the default version of the template.

  • Latest: always uses the latest version of the template.

Default

InstanceId

string

No

The ID of the instance. When you create a scaling group, Auto Scaling obtains the required configuration information from the specified instance and performs automatic creation of a scaling configuration.

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. If the number of instances in the scaling group is less than the value of MinSize, Auto Scaling performs automatic creation of 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. If the number of instances in the scaling group is greater than the value of MaxSize, Auto Scaling automatically removes instances.

The value range of MaxSize depends on your Auto Scaling usage. Go to Quota Center to check the quota for the maximum number of instances in a scaling group.

If the quota for the 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 completed. Valid values: 0 to 86400. Unit: seconds.

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

Default value: 300.

300

LoadBalancerIds

string

No

The IDs of the Classic load balancing (CLB) instances. The value can be a JSON array that contains multiple CLB instance IDs. Separate multiple IDs with commas (,).

The total number of CLB instances that can be associated with a single scaling group depends on your Auto Scaling usage. Go to Quota Center to check the quota for the maximum 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 the ApsaraDB RDS instances. The value can be a JSON array that contains multiple ApsaraDB RDS instance IDs. Separate multiple IDs with commas (,).

The total number of ApsaraDB RDS instances that can be associated with a single scaling group depends on your Auto Scaling usage. Go to Quota Center to check the quota for the maximum number of ApsaraDB RDS instances that can be associated with a scaling group.

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

RemovalPolicy.1

string

No

The first filtering policy of the instance scale-in policy. The value cannot be the same as those of RemovalPolicy.2 and RemovalPolicy.3. Valid values:

  • OldestInstance: removes the ECS instances that were added to the scaling group at the earliest point in time.

  • NewestInstance: removes the ECS instances that were added to the scaling group at the latest point in time.

  • OldestScalingConfiguration: removes the ECS instances that were created based on 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 only be set as the first scale-in policy. 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 multi-zone scaling policy (MultiAZPolicy) of the scaling group. For more information, see Configure a combined policy for removing instances.

OldestScalingConfiguration

RemovalPolicy.2

string

No

The second filtering policy of the instance scale-in policy. The value cannot be the same as those of RemovalPolicy.1 and RemovalPolicy.3. Valid values:

  • OldestInstance: removes the ECS instances that were added to the scaling group at the earliest point in time.

  • NewestInstance: removes the ECS instances that were added to the scaling group at the latest point in time.

  • OldestScalingConfiguration: removes the ECS instances that were created based on the earliest scaling configuration.

Note

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

OldestInstance

RemovalPolicy.3

string

No

The third filtering policy of the instance scale-in policy. The value cannot be the same as those of RemovalPolicy.1 and RemovalPolicy.2. Valid values:

  • OldestInstance: removes the ECS instances that were added to the scaling group at the earliest point in time.

  • NewestInstance: removes the ECS instances that were added to the scaling group at the latest point in time.

  • OldestScalingConfiguration: removes the ECS instances that were created based on the earliest scaling configuration.

Note

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

NewestInstance

VSwitchId

string

No

The ID of the vSwitch. After this parameter is specified, 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 is classic network by default.

vsw-bp14zolna43z266bq****

MultiAZPolicy

string

No

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

  • PRIORITY: the vSwitches (VSwitchIds.N) specified first have the highest priority. Auto Scaling preferentially attempts to scale ECS instances in the active zone where the highest-priority vSwitch resides. If the scaling fails, Auto Scaling automatically attempts to scale instances in the active zone of the next highest-priority vSwitch.

  • COST_OPTIMIZED: during scale-out, Auto Scaling attempts to create ECS instances in ascending order of vCPU unit price. During scale-in, Auto Scaling attempts to remove ECS instances in descending order of vCPU unit price. If the scaling configuration has settings for multiple instance types that use the preemptible billing method, spot instances are preferentially created. You can use the CompensateWithOnDemand parameter to specify whether to automatically attempt to 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: evenly allocate ECS instances across the multiple active zones specified in the scaling group. If the distribution becomes unbalanced across active zones due to insufficient inventory or other reasons, you can invoke the RebalanceInstance operation to balance the resources.

  • COMPOSABLE: a combined policy that allows you to combine the preceding multi-active-zone scaling policies for ECS instances as needed. You can also specify additional parameters to control the capacity of the scaling group in a more fine-grained manner.

Default value: PRIORITY.

PRIORITY

HealthCheckType

string

No

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

  • NONE: disables health checks.

  • ECS: performs health checks on instances in the scaling group. This value is used to enable instance health checks for both ECS and ECI scaling groups.

  • LOAD_BALANCER: determines the health status of instances based on the load balancing health check results. CLB load balancing is not supported.

Default value: ECS.

Note

If you need to enable both instance health checks and load balancing health checks, use the HealthCheckTypes parameter.

ECS

ScalingPolicy

string

No

The revoke pattern of the scaling group. Valid values:

  • recycle: sets the revoke pattern of the scaling group to the shutdown and revoke pattern.

  • release: sets the revoke pattern of the scaling group to the release pattern.

  • forcerelease: sets the revoke pattern of the scaling group to the forcible release pattern.

    Note

    If you select forcerelease, the system forcibly releases instances in the Running state during scale-down activities. Forcibly releasing an instance 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: sets the revoke pattern of the scaling group to the forcible shutdown and revoke pattern.

    Note

    If you select forcerecycle, the system forcibly shuts down instances in the Running state during scale-down activities. Forcible 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.

The ScalingPolicy parameter specifies the revoke pattern of the scaling group, but 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.

You can generate the parameter value from your client to ensure that the value is unique across different requests. The value can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see 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. If 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 in the excess instances after the scaling group meets the minimum number of pay-as-you-go instances (OnDemandBaseCapacity). 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 enable the supplemental spot instance feature. After this feature is enabled, when the scaling group receives a system message that a spot instance is about to be reclaimed, the scaling group attempts to create a new instance to replace the spot instance to be reclaimed.

true

CompensateWithOnDemand

boolean

No

Specifies whether to allow automatic attempts to create pay-as-you-go instances to meet the required number of ECS instances when the MultiAZPolicy parameter is set to COST_OPTIMIZED and sufficient spot instances cannot be created due to price, inventory, or other reasons. Valid values:

  • true: allows automatic attempts.

  • false: does not allow automatic attempts.

Default value: true.

true

SpotInstancePools

integer

No

The number of active instance types. The scaling group evenly creates spot instances across multiple instance types with the lowest costs. 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 of ECS instances in the scaling group. The scaling group automatically maintains the expected number of 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 for the scaling group. In this case, the scaling group cannot be deleted.

  • false: disables deletion protection for the scaling group.

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 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 use the VSwitchIds parameter, the VSwitchId parameter is ignored. After this parameter is specified, 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 vSwitches are prioritized in ascending numerical order, where 1 indicates the highest priority. If ECS instances cannot be created in the zone of a higher-priority vSwitch, the system automatically selects the next highest-priority vSwitch to create ECS instances.

Note

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

vsw-bp14zolna43z266bq****

string

No

The IDs of one or more vSwitches. If you use the VSwitchIds.N parameter, the VSwitchId parameter is ignored. After this parameter is specified, 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 vSwitches are prioritized in ascending numerical order, where 1 indicates the highest priority. If ECS instances cannot be created in the zone of a higher-priority vSwitch, the system automatically selects the next highest-priority vSwitch to create ECS instances.

Note

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

vsw-bp14zolna43z266bq****

LifecycleHook

array<object>

No

The lifecycle hook information.

object

No

The lifecycle hook information.

DefaultResult

string

No

The next action to perform after the wait state epoch ends. Valid values:

  • CONTINUE: continues the response to the scale-out activity or the scale-down activity.

  • ABANDON: releases the ECS instances created during the scale-out activity, or removes the ECS instances from the scaling group during the scale-down activity.

When a scale-down activity (SCALE_IN) occurs in the scaling group and triggers multiple lifecycle epoch hooks, if the wait state triggered by a lifecycle epoch hook whose DefaultResult is set to ABANDON ends, the other corresponding wait states end in advance. In other cases, the next action is subject to the next action of the last wait state that ends.

Default value: CONTINUE.

CONTINUE

LifecycleHookName

string

No

The name of the lifecycle hook. The name cannot be modified after it is specified. If you do not specify this parameter, the default value is the same as the lifecycle hook ID.

lifecyclehook****

LifecycleTransition

string

No

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

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

  • SCALE_IN: scale-down activities of the scaling group.

Note

If a lifecycle epoch hook is specified for the scaling group, this parameter is required, and other related parameters are optional.

SCALE_OUT

NotificationMetadata

string

No

The fixed string information for the wait state of the scaling activity. The 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 in advance. This helps you manage and mark different categories of notification information. The NotificationMetadata parameter takes effect only when you also specify the NotificationArn parameter.

Test

NotificationArn

string

No

The identity of the Notification Recipient for the lifecycle epoch hook. Simple Message Queue (formerly MNS) queues or topics are supported. The parameter value format is 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 configured by the lifecycle hook for the scaling group activity. After the wait state times out, the next action is performed. Valid values: 30 to 21600. Unit: seconds.

After you create a lifecycle hook, you can call the RecordLifecycleActionHeartbeat operation to extend the wait time of the ECS instance, or call the CompleteLifecycleAction operation to end the wait state of the scaling activity in advance.

Default value: 600.

600

VServerGroup

array<object>

No

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

array<object>

No

The collection of 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 more access requests are allocated to the instance. 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 Classic load balancing (CLB) instance to which the virtual service group belongs.

For more information, see AttachVServerGroups.

lb-bp1u7etiogg38yvwz****

Tag

array<object>

No

The collection of tag information for the scaling group.

object

No

The collection of tag information for 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 propagatable 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 information.

object

No

The launch template information.

InstanceType

string

No

When you need the scaling group to scale based on the instance type capacity, specify both this parameter and LaunchTemplateOverride.N.WeightedCapacity.

This parameter is used to specify the instance type, which overrides the instance type in the launch template. You can specify N values for this parameter to extend the launch template to support N instance types. Valid values of N: 1 to 20.

Note

This parameter takes effect only when the LaunchTemplateId parameter specifies a launch template.

Valid values of InstanceType: available ECS instance types. For more information, see Instance families.

ecs.c5.xlarge

WeightedCapacity

integer

No

When you need the scaling group to scale based on the instance type capacity, specify this parameter after you specify LaunchTemplateOverride.N.InstanceType. The two parameters correspond to each other, and N must be consistent.

This parameter is used to specify the weight of the instance type, which is the capacity represented by a single instance of the instance type in the scaling group. A larger weight indicates that fewer instances of this instance type are required to meet the expected capacity.

Because performance metrics such as the number of vCPUs and memory size vary among instance types, you can configure different weights for different instance types based on your requirements.

Example:

  • Current capacity: 0.

  • Expected capacity: 6.

  • Capacity of the ecs.c5.xlarge instance type: 4.

To meet the expected capacity, the scaling group scales out two ecs.c5.xlarge instances for you.

Note

During scale-out, the capacity of the scaling group cannot exceed the sum of the maximum capacity (MaxSize) and the maximum weight of the instance type.

Valid values of WeightedCapacity: 1 to 500.

4

SpotPriceLimit

number

No

This parameter is used to specify the maximum bid price for the overridden instance type (namely, LaunchTemplateOverride.N.InstanceType) in the instance 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.

0.025

AlbServerGroup

array<object>

No

The collection of ALB server group information.

object

No

The collection of ALB server group information.

AlbServerGroupId

string

No

The ID of the ALB server group.

N is the index of the ALB server group. A scaling group supports a limited number of associated ALB server groups. To view or manually apply for a quota increase, go to the 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 more requests are distributed to the instance. If the weight is 0, the instance does not receive requests. Valid values: 0 to 100.

N is the index 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 is the index of the ALB server group.

Note

If N is the same but Port is different, the system associates multiple ALB server groups with different ports to the scaling group by default.

22

ServerGroup

array<object>

No

The collection of load balancing server group information.

Note

You cannot configure the same server group Settings in both AlbServerGroups and ServerGroups at the same time.

object

No

The collection of load balancing server group information.

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 more access requests are allocated to the instance. If the weight is 0, the instance does not receive access requests.

Note

This parameter is required for ALB and NLB load balancing. You cannot configure the Settings of this parameter for GWLB load balancing.

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. You cannot configure the Settings of this parameter for GWLB load balancing, and the default value is 6081.

22

AzBalance

boolean

No

Specifies whether the capacity of the scaling group is evenly distributed across multiple zones. This parameter takes effect only when the MultiAZPolicy parameter 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 policy, which determines how the scaling group selects available instance types to meet the capacity requirements. The capacity distribution policy applies to both pay-as-you-go and spot capacity. This parameter takes effect only when the MultiAZPolicy parameter is set to COMPOSABLE. Valid values:

  • priority: Creates instances based on the order of the configured instance types.

  • lowestPrice: Creates instances based on the unit price per vCPU of the instance types in ascending order.

Default value: priority.

priority

SpotAllocationStrategy

string

No

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

  • priority: Creates instances based on the order of the configured instance types.

  • lowestPrice: Creates instances based on the unit price per vCPU of the instance types in ascending order.

Default value: priority.

lowestPrice

MaxInstanceLifetime

integer

No

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

Valid values: [86400, Integer.maxValue].

Default value: null.

Note

You cannot specify this parameter for scaling groups of the ECI type or scaling groups for which the economical mode is enabled.

86400

CustomPolicyARN

string

No

The ARN of the Function Compute function for the custom scale-in policy. 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 newly created scaling group belongs.

Note

Assigns the newly created scaling group to the specified resource group. If you do not specify this parameter, the scaling group belongs to the default resource group.

rg-123****

LoadBalancerConfig

array<object>

No

The list of Classic Load Balancing (CLB) configurations.

object

No

The list of Classic Load Balancing (CLB) configurations.

LoadBalancerId

string

No

The ID of the Classic Load Balancing (CLB) 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 Classic Load Balancing (CLB) server group. A higher weight indicates that more access requests are allocated to the instance. 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 specify multiple values for this parameter to enable multiple health check options. If the HealthCheckType parameter is specified, this parameter is ignored.

string

No

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

  • NONE: No health check is performed.

  • ECS: Performs health checks on instances in the scaling group. This value is used to enable instance health checks for both ECS and ECI scaling groups.

  • LOAD_BALANCER: Determines the health status of instances based on the health check results of load balancing. Classic Load Balancing (CLB) is not supported.

Default value: ECS.

ECS

DBInstance

array<object>

No

The list of databases associated with the scaling group.

object

No

The configuration information of the databases associated with the scaling group.

DBInstanceId

string

No

The database instance ID.

rm-m5eqju85s45mu0***

Type

string

No

The type of the database. Valid values:

  • RDS

  • Redis

  • MongoDB

Default value: RDS.

RDS

AttachMode

string

No

The association mode between the scaling group and the database. Valid values:

  • SecurityIp: IP whitelist mode. Automatically adds scaled-out instances to the IP whitelist of the database. Only ApsaraDB RDS databases are supported.

  • SecurityGroup: Security group mode. Adds the security group of the scaling configuration to the security group whitelist of the database to allow instances in the security group to access the database.

SecurityIp

StopInstanceTimeout

integer

No

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

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

  • If this parameter is specified, the system waits for a maximum of the StopInstanceTimeout period for the instance to be stopped. After the timeout period elapses, the scale-in process continues regardless of whether the instance is stopped.

  • If this parameter is not specified, the system waits for a long time for the instance to be stopped. The scale-in process continues only after the instance is stopped. If the instance fails to be stopped, the scale-in process is rolled back and the scale-in 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. When 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 the MultiAZPolicy parameter is set to COMPOSABLE, the default value is 0.

30

OnDemandPercentageAboveBaseCapacity

integer

No

The percentage of pay-as-you-go instances in the excess instances after the scaling group meets the minimum number of pay-as-you-go instances specified by OnDemandBaseCapacity. Valid values: 0 to 100.

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

20

CompensateWithOnDemand

boolean

No

Specifies whether to allow the system to automatically attempt to create pay-as-you-go instances to meet the required number of ECS instances when the MultiAZPolicy parameter is set to COST_OPTIMIZED and sufficient spot instances cannot be created due to price or inventory reasons. Valid values:

  • true: Allowed.

  • false: Not allowed.

Default value: true.

true

SpotAutoReplaceOnDemand

boolean

No

Specifies whether to attempt to use spot instances to replace pay-as-you-go capacity when CompensateWithOnDemand is enabled and the proportion of pay-as-you-go instances exceeds the OnDemandPercentageAboveBaseCapacity value. In common scenarios where CompensateWithOnDemand downgrades spot instances to pay-as-you-go instances due to spot inventory or price reasons, this feature attempts to use spot instances to replace the excess pay-as-you-go capacity to avoid long-term retention of pay-as-you-go instances. Valid values:

  • true: Allowed.

  • false: Not allowed.

Default value: false.

false

PriceComparisonMode

string

No

The price comparison mode for the cost optimization policy 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 is equal to the weight set for the instance type. The default weight is 1, which means one ECS instance occupies one unit of capacity.

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

Default value: PricePerUnit.

PricePerUnit

BalanceMode

string

No

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

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

  • BalancedOnly: When resource creation fails in a zone, the system does not fall back to other zones. The scale-out activity partially succeeds to avoid excessive imbalance of resources across different 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 zone balancing. Valid values:

  • false: Disables automatic rebalancing for the scaling group.

  • true: Enables automatic rebalancing for the scaling group. The scaling group automatically detects the capacity across zones. When the capacity is unbalanced, the scaling group proactively scales out or in to rebalance the capacity across zones.

Default value: false.

false

ZoneShiftPolicy

object

No

The action to take on an instance when it fails to start during a scale-out activity of the scaling group. Valid values:

  1. release (default): Releases the instance that failed to start.

  2. retain: Retains the instance that failed to start in the stopped state in the scaling group, and the system will continue to attempt to start it during the next scale-out activity. Note: Stopped instances are counted towards the MaxSize of the scaling group. If the capacity of stopped instances reaches MaxSize, the scale-out activity will not create new instances and will only start instances from the stopped state, which may cause continuous scale-out failures.

This parameter takes effect when ScalingPolicy is set to recycle or forcerecycle.

ScaleOutInHealthyZonesOnly

boolean

No

Specifies whether scale-out creates instances only in healthy zones during a zone shift. Valid values:

  • true: Scale-out creates instances only in healthy zones and skips impaired zones.

  • false: Does not restrict zones. Scale-out can create instances in any zone of the scaling group.

Default value: false.

true

ScaleInBlockedRuleTypes

array

No

The types of scaling rules whose triggered scale-in is blocked. The blocking scope is all zones under the scaling group, not just impaired zones. This prevents false scale-in caused by fake improvement of monitoring metrics due to unreachable instances in impaired zones. Valid values:

  • StepScalingRule: Blocks scale-in triggered by step scaling rules.

  • TargetTrackingScalingRule: Blocks scale-in triggered by target tracking scaling rules.

  • None: Does not block.

Default value: None.

StepScalingRule

string

No

The types of scaling rules whose triggered scale-in is blocked. The blocking scope is all zones under the scaling group, not just impaired zones. This prevents false scale-in caused by fake improvement of monitoring metrics due to unreachable instances in impaired zones. Valid values:

  • StepScalingRule: Blocks scale-in triggered by step scaling rules.

  • TargetTrackingScalingRule: Blocks scale-in triggered by target tracking scaling rules.

  • None: Does not block.

Default value: None.

StepScalingRule

ImpairedZoneHealthCheckBehavior

string

No

The health check behavior in impaired zones. Valid values:

  • ReplaceUnhealthy: Replaces unhealthy instances in all zones normally.

  • IgnoreUnhealthy: Does not replace unhealthy instances in impaired zones. Healthy zones are not affected.

Default value: ReplaceUnhealthy.

ReplaceUnhealthy

Response elements

Element

Type

Description

Example

object

RequestId

string

The ID of the request.

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

ScalingGroupId

string

The ID of the scaling group.

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.