Set 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 header

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

Request syntax

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

Request Parameters

Parameter Type Required Example Description
AppId String Yes ”appID“

The ID of the application for which you want to set the Tomcat parameters.

GroupId String Yes "GroupId"

Deployment Group ID

InCpu Integer Yes 50

Trigger indicator: CPU usage

InDuration Integer Yes 50

Duration exceeds, unit: minutes

InEnable String Yes true

Indicates whether the scale-in rule is included.

InInstanceNum Integer Yes 3

Minimum number of instances during group scale-in

InLoad Integer Yes 50

Trigger metric: system load

InRT Integer Yes 50

Trigger indicator: service latency

InStep Integer Yes 1

The number of instances in each scale-in

OutCPU Integer Yes 50

Trigger indicator: CPU usage

OutDuration Integer Yes 50

Duration exceeds, unit: minutes

OutEnable String Yes true

Indicates whether the cluster contains scale-out rules.

OutInstanceNum Integer Yes 10

Maximum instances per group for scale-out

OutLoad Integer Yes 50

Trigger metric: system load

OutRT Integer Yes 0

Trigger indicator: service latency

OutStep Integer Yes 0

Number of Instances for Each Scale-Out

InCondition String No ""

Trigger conditions: any condition is OR, AND all conditions are AND

OutCondition String No ""

Trigger conditions: any condition is OR, AND all conditions are AND

ResourceFrom String No ""

The source of the instance. Elastic resources are NEW, existing resources are AVAILABLE, and existing resources are AVAILABLE_FIRST first. Auto-scaling parameters must be specified for NEW or AVAILABLE_FIRST. You can start templates or configure rules based on existing instances.

MultiAzPolicy String No ""

The multi-zone scaling policy for auto scaling. Set the PRIORITY to PRIORITY and the BALANCE distribution strategy to BALANCE.

VpcId String No ""

The ID of the Vpc associated with the launch template or rule based on existing instances specified for auto scaling.

VSwitchIds String No ""

List of VPC-related vswitch IDs separated with commas (,)

ScalingPolicy String No ""

The Reclaim mode for scale-out. In this case, release is set to release and recycle is set to recycle.

TemplateInstanceId String No ""

The instance ID of auto scaling "based on existing instance rule". This parameter is valid only when OutEnable is set to true.

TemplateInstanceName String No ""

The name of the auto scaling instance "based on existing instance rules". This parameter is valid only if the TemplateInstanceId exists.

Password String No ""

The password used to log on to the instance. This parameter is valid only when the auto scaling rule is based on existing instance.

KeyPairName String No ""

The name of the Logon Key for the instance. This parameter is valid only when the auto scaling option is set to based on existing instance rules.

AcceptEULA Boolean No true

If you use auto scaling, you must specify true

TemplateId String No ""

The ID of the startup template for auto scaling. This parameter is valid only if the OutEnable parameter is set to true. The OutEnable parameter takes precedence over the TemplateInstanceId parameter.

TemplateVersion Integer No -1

Auto Scaling "start template" version. This parameter is valid only if TemplateId is true. If the default template is used, pass -1. Otherwise, the corresponding version number is

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 header
{
  "AppId": "”appID“"
  "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.