All Products
Search
Document Center

Auto Scaling:EnableScalingGroup

Last Updated:Feb 28, 2024

Enables a scaling group.

Operation description

You can call this operation to enable a scaling group that is in the Inactive state and has an instance configuration source. The instance configuration source can be a scaling configuration, a launch template, or an Elastic Compute Service (ECS) instance that you specified when you created the scaling group. If a scaling group is not in the Inactive state or does not have an active instance configuration source, you cannot call this operation to enable the scaling group.

Note A scaling group can have only one active instance configuration source. When you call this operation to enable a scaling group, you can specify a scaling configuration or a launch template for the scaling group. If an instance configuration source has been configured for the scaling group before you call this operation, the scaling configuration or launch template that you specify in the request overwrites the original scaling configuration or launch template.

If you specify a value for the InstanceIds parameter when you call the operation, Auto Scaling checks whether the total number of ECS instances is within the range allowed in the scaling group after you call the operation.

  • If the total number of ECS instances is less than the minimum number of instances required in the scaling group after you call the operation, Auto Scaling automatically creates the required number of pay-as-you-go ECS instances and adds the instances to the scaling group to reach the minimum number. For example, if the minimum number of instances required in your scaling group is five, and you specify the InstanceIds parameter to add two ECS instances to the scaling group, Auto Scaling automatically creates three instances in the scaling group after the two instances are added.
  • If the value of the TotalCapacity parameter is greater than the value of the MaxSize parameter, the call fails.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
ScalingGroupIdstringYes

The ID of the scaling group.

asg-bp14wlu85wrpchm0****
ActiveScalingConfigurationIdstringNo

The ID of the scaling configuration that you want to put into the Active state.

asc-bp1ffogfdauy0nu5****
LaunchTemplateIdstringNo

The ID of the launch template that is used by Auto Scaling to create ECS instances.

lt-m5e3ofjr1zn1aw7****
LaunchTemplateVersionstringNo

The version number of the launch template. Valid values:

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

The IDs of ECS instances that you want to add to the scaling group after you enable the scaling group.

The ECS instances must meet the following requirements:

  • The ECS instances and the scaling group must reside in the same region.
  • The ECS instances must be in the Running state.
  • The ECS instances are not added to other scaling groups.
  • The billing method of the ECS instances must be subscription or pay-as-you-go, or the ECS instances must be preemptible instances.
  • If you specify the VswitchID parameter for the scaling group, the ECS instances must reside in the same virtual private cloud (VPC) as the specified vSwitch. You cannot add the ECS instances that reside in the classic network or other VPCs to the scaling group.
  • If you do not specify the VswitchID parameter for the scaling group, you cannot add ECS instances that reside in VPCs to the scaling group.
stringNo

The IDs of ECS instances that you want to add to the scaling group after you enable the scaling group.

The ECS instances must meet the following requirements:

  • The ECS instances and the scaling group must reside in the same region.
  • The ECS instances must be in the Running state.
  • The ECS instances are not added to other scaling groups.
  • The billing method of the ECS instances must be subscription or pay-as-you-go, or the ECS instances must be preemptible instances.
  • If you specify the VswitchID parameter for the scaling group, the ECS instances must reside in the same VPC as the specified vSwitch. You cannot add the instances that reside in the classic network or other VPCs to the scaling group.
  • If you do not specify the VswitchID parameter for the scaling group, you cannot add ECS instances that reside in VPCs to the scaling group.
i-283vv****
LoadBalancerWeightsarrayNo

The weight of an ECS instance as a backend server in the backend vServer group.

Default value: 50.

integerNo

The weight of an ECS instance as a backend server in the backend vServer group.

Default value: 50.

50
LaunchTemplateOverridesobject []No

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

InstanceTypestringNo

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

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

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

You can specify an instance type that is available for purchase as the value of the InstanceType parameter.

ecs.c5.xlarge
WeightedCapacityintegerNo

The weight of the instance type. The weight specifies the capacity of a single instance of the specified instance type in the scaling group. If you want to scale instances based on the weighted capacities of the instances, you must specify the WeightedCapacity parameter after you specify the InstanceType parameter.

A higher weight specifies that a smaller number of instances of the specified instance type are required to meet the expected capacity requirement.

Performance metrics, such as the number of vCPUs and the memory size of each instance type, may vary. You can specify different weights for different instance types based on your business requirements.

Example:

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

To meet the expected capacity requirement, Auto Scaling must create and add two ecs.c5.xlarge instances.

Note The capacity of the scaling group cannot exceed the sum of the maximum number of instances that is specified by the MaxSize parameter and the maximum weight of the instance types.

Valid values of the WeightedCapacity parameter: 1 to 500.

4
RegionIdstringNo

The region ID of the scaling group.

cn-qingdao

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

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

Examples

Sample success responses

JSONformat

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

Error codes

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

Change history

Change timeSummary of changesOperation
No change history