All Products
Search
Document Center

Auto Scaling:EnableScalingGroup

最終更新日:Nov 11, 2024

Enables a scaling group. If a scaling group is in the Disabled state and contains an instance configuration source such as a launch template or a scaling configuration, you can call the EnableScalingGroup operation to enable the scaling group. This operation permits Auto Scaling to dynamically adjust the computing power (also known as the number of instances) in the scaling group based on your business requirements.

Operation description

  • You can call this operation to enable a scaling group only if the scaling group is in the Inactive state and contains an instance configuration source such as a launch temple or a scaling configuration. The instance configuration source can also be the Elastic Compute Service (ECS) instance that you specified when you created the scaling group. If the preceding requirements are not met, the operation will fail.

    **

    Note A scaling group can have only one active instance configuration source at a time. 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 the scaling group already have an instance configuration source defined prior to your calling, the scaling configuration or launch template specified within your request will supersede the existing scaling configuration or launch template.

  • If you specify InstanceId.N to add to the scaling group within your request, Auto Scaling will check whether the addition of InstanceId.N will cause the total number of ECS instances in the scaling group to fall outside the boundaries specified by MinSize and MaxSize after you call this operation.

    • If the call results in the total number of ECS instances dropping below the value of MinSize, Auto Scaling proactively creates pay-as-you-go ECS instances to ensure that the total number reaches the minimum threshold. For example, if you set MinSize to 5 when you created a scaling group and include InstanceId.N within your request to add two ECS instances when you attempt to enable the scaling group, Auto Scaling creates three more ECS instances in the scaling group after the two ECS instances are added.
    • If the call results in the total number of ECS instances exceeding the value of MaxSize, the operation fails.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ess:EnableScalingGroupupdate
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ScalingGroupIdstringYes

The ID of the scaling group.

asg-bp14wlu85wrpchm0****
ActiveScalingConfigurationIdstringNo

The ID of the scaling configuration that you want to enable in the scaling group.

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 is always used.
  • Latest: The latest template version is always used.
Default
InstanceIdsarrayNo

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

Before you add ECS instances to the scaling group, make sure that the instances meet the following requirements:

  • The instances must reside in the same region as the scaling group.
  • The instances must be in the Running state.
  • The instances do not belong to another scaling group.
  • The instances are billed on a subscription or pay-as-you-go basis, or the instances are preemptible instances.
  • If you specify VswitchID for the scaling group, the instances must share the same VPC as the scaling group.
  • If you do not specify VswitchID for the scaling group, the instances must use the classic network.
stringNo

The ID of the ECS instance that you want to add to the scaling group after the scaling group is enabled.

Before you add an ECS instance to the scaling group, make sure that the instance meets the following requirements:

  • The instance must reside in the same region as the specified scaling group.
  • The instance must be in the Running state.
  • The instance does not belong to another scaling group.
  • The instance is billed on a subscription or pay-as-you-go basis, or the instance is a preemptible instance.
  • If you specify VswitchID for the scaling group, the instance must share the same VPC as the scaling group.
  • If you do not specify VswitchID for the scaling group, the instance must use the classic network.
i-283vv****
LoadBalancerWeightsarrayNo

The weights of ECS instances or elastic container instances as backend servers.

Default value: 50.

integerNo

The weight of an ECS instance or elastic container instance as a backend server.

Default value: 50.

50
LaunchTemplateOverridesarray<object>No

The information about the instance types that you want to extend in the launch template.

objectNo

Details of the instance types that are specified in the extended configurations of the launch template.

InstanceTypestringNo

The instance type. If you want to scale instances based on instance type weights in the scaling group, you must specify LaunchTemplateOverrides.WeightedCapacity after you specify this parameter.

The instance type specified by using this parameter overwrites the instance type of the launch template.

Note This parameter takes effect only if you specify LaunchTemplateId.

You can use this parameter to specify any instance types that are available for purchase.

ecs.c5.xlarge
WeightedCapacityintegerNo

The weight of the instance type. If you want to scale instances based on instance type weights in the scaling group, you must specify this parameter after you specify LaunchTemplateOverrides.InstanceType.

The weight specifies the capacity of an instance of the specified instance type in the scaling group. 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 reach the expected capacity, Auto Scaling must scale out two instances of ecs.c5.xlarge.

Note The total capacity of the scaling group is constrained and cannot surpass the combined total of the maximum group size defined by MaxSize and the highest weight assigned to any instance type.

Valid values of WeightedCapacity: 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