Sets scaling rules.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request headers

This operation only uses the common request header. For more information, see Common request parameters.

Request syntax

POST|PUT /pop/v5/app/scaling_rules2 HTTPS|HTTP

Request parameters

Parameter Type Required Example Description
AppId String Yes 74ee****-db65-4322-a1f6-bcb60e5b****

The ID of the application for which you want to set scaling rules.

GroupId String Yes "GroupId"

The ID of the instance group to which the application is deployed.

InCpu Integer Yes 50

The minimum CPU utilization that triggers the scale-in operation.

InDuration Integer Yes 50

The duration in which the metric threshold is exceeded. Unit: minutes.

InEnable Boolean Yes true

Specifies whether the scale-in rule is configured.

InInstanceNum Integer Yes 3

The minimum number of instances in an instance group after a scale-in operation.

InLoad Integer Yes 50

The minimum system load that triggers the scale-in operation.

InRT Integer Yes 50

The minimum service latency that triggers the scale-in operation.

InStep Integer Yes 1

The number of instances that you can remove during each scale-in.

OutCPU Integer Yes 50

The minimum CPU utilization that triggers the scale-out operation.

OutDuration Integer Yes 50

The duration in which the metric threshold is exceeded. Unit: minutes.

OutEnable Boolean Yes true

Specifies whether the scale-out rule is configured.

OutInstanceNum Integer Yes 10

The maximum number of instances in an instance group after a scale-out operation.

OutLoad Integer Yes 50

The minimum system load that triggers the scale-out operation.

OutRT Integer Yes 0

The minimum service latency that triggers the scale-out operation.

OutStep Integer Yes 0

The number of instances that you can add during each scale-out.

InCondition String No ""

Trigger conditions. Valid values: OR and AND. If you set the value to OR, the scale-in operation is triggered when one of the conditions is met. If you set the value to AND, the scale-in operation is triggered only when all conditions are met.

OutCondition String No ""

Trigger conditions. Valid values: OR and AND. If you set the value to OR, the scale-out operation is triggered when one of the conditions is met. If you set the value to AND, the scale-out operation is triggered only when all conditions are met.

ResourceFrom String No ""

The source of the instance to be added during a scale-out. Valid values: NEW, AVAILABLE, and AVAILABLE_FIRST. If you set the value to NEW, new resources are used. If you set the value to AVAILABLE, the existing resources are used. If you set the value to AVAILABLE_FIRST, the existing resources are first used. If you set this parameter to NEW or AVAILABLE_FIRST, the auto-scaling parameters must be specified. After auto scaling is enabled, the instances that are added to scale out an instance group are created based on the launch template or the specification of an existing instance in the group.

MultiAzPolicy String No ""

The policy of auto scaling across multiple zones. Valid values: PRIORITY and BALANCE. If you set the value to PRIORITY, the priority-based policy is used. If you set the value to BALANCE, the balanced distribution policy is used.

VpcId String No ""

The ID of the VPC that is associated with the instances created based on the launch template or the specification of an existing instance.

VSwitchIds String No ""

The IDs of the vSwitches in the VPC. Separate multiple vSwitch IDs with commas (,).

ScalingPolicy String No ""

The mode of reclaiming instances that are added to scale out an instance group. Valid values: release and recycle. If you set the value to release, the instances are released. If you set the value to recycle, the instances are shut down and recycled.

TemplateInstanceId String No ""

The ID of the instance that is purchased based on the specification of an existing instance. This parameter only takes effect when the OutEnable parameter is set to true.

TemplateInstanceName String No ""

The name of the instance that is purchased based on the specification of an existing instance. This parameter only takes effect when the TemplateInstanceId parameter is specified.

Password String No ""

The password used to log on to the instance. This parameter only takes effect when the instance is purchased based on the specification of an existing instance.

KeyPairName String No ""

The name of the key pair used to log on to the instance. This parameter only takes effect when the instance is purchased based on the specification of an existing instance.

AcceptEULA Boolean No true

To use auto scaling, set this parameter to true.

TemplateId String No ""

The ID of the launch template used for auto scaling. This parameter only takes effect when the OutEnable parameter is set to true. The TemplateId parameter takes precedence over the TemplateInstanceId parameter.

TemplateVersion Integer No -1

The version of the launch template used for auto scaling. This parameter only takes effect when the TemplateId parameter is specified. To use the default template, set the TemplateVersion parameter to -1. Otherwise, specify the TemplateVersion parameter to the version number of the launch template that you want to use.

Response parameters

Parameter Type Example Description
Code Integer 200

The returned code.

Message String success

The returned message.

Examples

Sample requests

POST /pop/v5/app/scaling_rules2 HTTP/1.1
Common request parameters
{
  "AppId": "74ee****-db65-4322-a1f6-bcb60e5b****",
  "GroupId": ""GroupId""
  "InCpu": 50
  "InDuration": 50
  "InEnable": true
  "InInstanceNum": 3
  "InLoad": 50
  "InRT": 50
  "InStep": 1
  "OutCPU": 50
  "OutDuration": 50
  "OutEnable": true
  "OutInstanceNum": 10
  "OutLoad": 50
  "OutRT": 0
  "OutStep": 0
}

Sample success responses

JSON format

{
	"Code": "200",
	"Message": "success "
}

Error codes

For a list of error codes, visit the API Error Center.