All Products
Search
Document Center

Auto Scaling:EnableScalingGroup

Last Updated:Sep 10, 2026

Enables a scaling group.

Operation description

Operation description

  • You can invoke this operation to enable a scaling group only when the scaling group is in the Inactive state and has an instance configuration source (a scaling configuration, a launch template, or ECS instances specified during scaling group creation). Otherwise, the invocation fails.

    Note

    A scaling group can have only one active instance configuration source at a time. When you invoke this operation, you can specify a scaling configuration or launch template for the scaling group. If you have already configured an instance configuration source for the scaling group before invoking this operation, specifying a scaling configuration or launch template overwrites the existing configuration.

  • If you specify ECS instances (InstanceId.N) to add to the scaling group when invoking this operation, Auto Scaling checks whether the total number of ECS instances (Total Capacity) in the scaling group falls between the minimum value (MinSize) and the maximum value (MaxSize) after the ECS instances are added:

    • If the Total Capacity of the scaling group is less than MinSize, Auto Scaling performs automatic creation of pay-as-you-go ECS instances to make up the difference.

    For example, if you set MinSize to 5 when creating the scaling group and specify 2 existing ECS instances in the InstanceId.N parameter when enabling the scaling group, Auto Scaling adds the 2 existing ECS instances and then performs automatic creation of 3 more ECS instances.

    • If the Total Capacity of the scaling group is greater than MaxSize, the invocation failed.

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:EnableScalingGroup

update

*ScalingGroup

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

None None

Request parameters

Parameter

Type

Required

Description

Example

ScalingGroupId

string

Yes

The ID of the scaling group.

asg-bp14wlu85wrpchm0****

ActiveScalingConfigurationId

string

No

The ID of the scaling configuration to be activated in the scaling group.

asc-bp1ffogfdauy0nu5****

LaunchTemplateId

string

No

The ID of the launch template. This parameter specifies that the scaling group obtains launch configuration information from the launch template.

lt-m5e3ofjr1zn1aw7****

LaunchTemplateVersion

string

No

The version of the launch template. Valid values:

  • A fixed template version number.

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

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

Default

InstanceId

array

No

The ID of the ECS instance to add to the scaling group after the scaling group is enabled. Valid values of N: 1 to 20.

The ECS instances to be added to the scaling group must meet the following conditions:

  • The instances must be in the same region as the scaling group.

  • The instances must be in the Running state.

  • The instances must not already belong to another scaling group.

  • The billing method of the instances must be subscription, pay-as-you-go, or spot instance.

  • If the scaling group has a specified VswitchID, classic network ECS instances cannot be added to the scaling group, and ECS instances from other VPCs cannot be added to the scaling group.

  • If the scaling group does not have a specified VswitchID, VPC-type ECS instances cannot be added to the scaling group.

i-283vv****

string

No

The ID of the ECS instance to add to the scaling group after the scaling group is enabled. Valid values of N: 1 to 20.

The ECS instances to be added to the scaling group must meet the following conditions:

  • The instances must be in the same region as the scaling group.

  • The instances must be in the Running state.

  • The instances must not already belong to another scaling group.

  • The billing method of the instances must be subscription, pay-as-you-go, or spot instance.

  • If the scaling group has a specified VswitchID, classic network ECS instances cannot be added to the scaling group, and ECS instances from other VPCs cannot be added to the scaling group.

  • If the scaling group does not have a specified VswitchID, VPC-type ECS instances cannot be added to the scaling group.

i-283vv****

LoadBalancerWeight

array

No

The weight of the ECS instance or elastic container instance as a backend server of the associated Server Load Balancer (SLB) instance. Valid values of N: 1 to 20. Valid values of this parameter: 1 to 100.

Default value: 50.

50

integer

No

The weight of the ECS instance or elastic container instance as a backend server of the associated SLB instance. Valid values of N: 1 to 20. Valid values of this parameter: 1 to 100.

Default value: 50.

50

LaunchTemplateOverride

array<object>

No

The override information of the launch template.

object

No

The override information of the launch template.

InstanceType

string

No

If you want the scaling group to scale based on the capacity of instance types, specify both this parameter and LaunchTemplateOverride.N.WeightedCapacity.

This parameter specifies ECS instance type and overrides ECS 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 10.

Note

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

For valid values of InstanceType, see Instance families.

ecs.c5.xlarge

WeightedCapacity

integer

No

If you want the scaling group to scale based on the capacity of instance types, specify this parameter after you specify LaunchTemplateOverride.N.InstanceType. The two parameters correspond to each other on a one-to-one basis, and the values of N must be the same.

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 higher weight means that fewer instances of this type are required to meet the expected capacity.

Because instance types differ in the number of vCPUs, memory size, and other performance metrics, you can assign different weights to different instance types based on your requirements.

For 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 by adding 2 ecs.c5.xlarge instances.

Note

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

Valid values of WeightedCapacity: 1 to 500.

4

RegionId

string

No

The region ID of the scaling group.

cn-qingdao

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

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

Examples

Success response

JSON format

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.