EnableScalingGroup

Updated at:

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 an instance configuration source (a scaling configuration, a launch template, or an ECS instance specified during the creation of the scaling group) is configured for the scaling group. Otherwise, the invoke failed.

    Note

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

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

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

    For example, if you set MinSize to 5 when you create a scaling group and specify two existing ECS instances in the InstanceId.N parameter when you enable the scaling group, Auto Scaling adds the two existing ECS instances and then performs automatic creation of three ECS instances.

    • If the Total Capacity of the scaling group is greater than MaxSize, the invoke 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 enabled in the scaling group.

asc-bp1ffogfdauy0nu5****

LaunchTemplateId

string

No

The ID of the launch template, which is used to specify that the scaling group obtains the 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 IDs of the ECS instances to be added 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 ECS instances must be in the same region as the scaling group.

  • The ECS instances must be in the Running state.

  • The ECS instances must not be added to other scaling groups.

  • The ECS instances must be subscription, pay-as-you-go, or spot instances.

  • If a vSwitch ID (VswitchID) is specified for the scaling group, classic network-connected ECS instances and ECS instances in other VPCs cannot be added to the scaling group.

  • If no vSwitch ID (VswitchID) is specified for the scaling group, VPC-connected ECS instances cannot be added to the scaling group.

i-283vv****

string

No

The IDs of the ECS instances to be added 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 ECS instances must be in the same region as the scaling group.

  • The ECS instances must be in the Running state.

  • The ECS instances must not be added to other scaling groups.

  • The ECS instances must be subscription, pay-as-you-go, or spot instances.

  • If a vSwitch ID (VswitchID) is specified for the scaling group, classic network-connected ECS instances and ECS instances in other VPCs cannot be added to the scaling group.

  • If no vSwitch ID (VswitchID) is specified for the scaling group, VPC-connected ECS instances cannot be added to the scaling group.

i-283vv****

LoadBalancerWeight

array

No

The weight of an ECS instance or elastic container instance (ECI) added to the scaling group as a backend server. Valid values of N: 1 to 20. Valid values of this parameter: 1 to 100.

Default value: 50.

50

integer

No

The weight of an ECS instance or elastic container instance (ECI) added to the scaling group as a backend server. 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 for the launch template.

object

No

The override information for the launch template.

InstanceType

string

No

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

This parameter is used to specify 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 10.

Note

This parameter takes effect only when the LaunchTemplateId parameter is specified.

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 one by one, and the value of N must be the same.

This parameter is used to specify the weight of the instance type, which indicates the capacity that a single instance of the instance type represents in the scaling group. A greater 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 with each instance type, you can configure different weights for different instance types based on your business 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.

Note

During a scale-out event, 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

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.