Modifies the scaling rule for an application.

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 uses only common request headers. For more information, see the topic about common request parameters.

Request syntax

POST|PUT /pop/v5/app/scaling_rules HTTP/1.1

Request parameters

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

The ID of the application.

GroupId String Query Yes 8123db90-880f-486f-****-************

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

InCondition String Query No "OR"

The relationship among the conditions that trigger a scale-in.

  • OR: one of the conditions
  • AND: all conditions
InEnable Boolean Query No true

Specifies whether to allow scale-ins.

  • true: allows scale-ins.
  • false: does not allow scale-ins.
InCpu Integer Query No 50

The minimum CPU utilization that triggers a scale-in.

InDuration Integer Query No 50

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

InInstanceNum Integer Query No 3

The minimum number of instances that must be retained in each group when a scale-in is performed.

InLoad Integer Query No 50

The minimum system load that triggers a scale-in.

InRT Integer Query No 50

The minimum service latency that triggers a scale-in.

InStep Integer Query No 1

The number of instances that are removed during each scale-in.

OutCondition String Query No "OR"

The relationship among the conditions that trigger a scale-out.

  • OR: one of the conditions
  • AND: all conditions
OutCPU Integer Query No 50

The minimum CPU utilization that triggers a scale-out.

OutDuration Integer Query No 50

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

OutEnable Boolean Query No true

Specifies whether to allow scale-outs.

OutInstanceNum Integer Query No 10

The maximum number of instances in each group when a scale-out is performed.

OutLoad Integer Query No 50

The minimum system load that triggers a scale-out.

OutRT Integer Query No 0

The minimum service latency that triggers a scale-out.

OutStep Integer Query No 0

The number of instances that are added during each scale-out.

ResourceFrom String Query No "AVAILABLE"

The source of the instance to be added during a scale-out. Valid values:

  • NEW: elastic resources
  • AVAILABLE: existing resources
If you prefer existing resources to elastic resources, set this parameter to AVAILABLE_FIRST.

If you set this parameter to NEW or AVAILABLE_FIRST, you must specify the auto-scaling parameters. If you set this parameter to NEW, instances are created based on a launch template or the specifications of an existing instance.

MultiAzPolicy String Query No "PRIORITY"

The multi-zone scaling policy. Valid values:

  • PRIORITY: The vSwitch that is first selected has the highest priority.
  • BALANCE: This policy evenly distributes instances across zones in which the vSwitches reside.
VpcId String Query No "vpc-bp1j55oz3bgd7zepxxxxxxx"

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

VSwitchIds String Query No "vsw-bp1ldxs3d4fdgikyxxxxxx"

The IDs of the vSwitches that are associated with the VPC. Separate multiple IDs with commas (,).

ScalingPolicy String Query No "release"

The instance handling mode during a scale-in. Valid values:

  • release: When a scale-in is performed, instances that are no longer used are released.
  • recycle: When a scale-in is performed, instances that are no longer used are stopped and reclaimed.
TemplateInstanceId String Query No "1"

The ID of the instance whose specifications are used to create instances during a scale-out. This parameter is valid only when you set the OutEnable parameter to true.

TemplateInstanceName String Query No "tpl-tdy218"

The name of the instance whose specifications are used to create instances during a scale-out. This parameter is valid only when you specify the TemplateInstanceId parameter.

Password String Query No "Pwdxxxxxxx"

The password that is used to log on to the instance. This parameter is valid only when you choose to add instances based on the specifications of an existing instance during a scale-out.

KeyPairName String Query No "tdy218"

The key pair that is used to log on to the instance. This parameter is valid only when you choose to add instances based on the specifications of an existing instance during a scale-out.

AcceptEULA Boolean Query No true

Set the value to true if scale-outs are allowed.

TemplateId String Query No "lt-wz9hkhn8wpq2zxxxx"

The ID of the launch template that is used to create instances during a scale-out. This parameter is valid only when you set the OutEnable parameter to true. This parameter takes precedence over the TemplateInstanceId parameter.

TemplateVersion Integer Query No -1

The version of the launch template that is used to create instances during a scale-out. This parameter is valid only when you specify the TemplateId parameter. To use the default template version, set this parameter to -1. Otherwise, set this parameter to the version that you want to use.

Response parameters

Parameter Type Example Description
Code Integer 200

The HTTP status code.

Message String success

The returned message that indicates whether the call is successful.

RequestId String CB36E997-FE54-476C-8C0D-4E8A9EBxxxxx

The ID of the request.

Examples

Sample requests

POST /pop/v5/app/scaling_rules HTTP/1.1
Common request headers
{
"AppId": "74ee****-db65-4322-a1f6-bcb60e5b****",
"GroupId": "8123db90-880f-486f-****-************",
"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

XML format

<Code>200</Code>
<Message>success</Message>

JSON format

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

Error codes

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