Help Center/ TaurusDB/ API Reference/ APIs (Recommended)/ Instance Management/ Setting a Custom Serverless Scale-Up Policy
Updated on 2025-10-21 GMT+08:00

Setting a Custom Serverless Scale-Up Policy

Function

This API is used to set a custom serverless scale-up policy. Before calling this API:

Constraints

This API is in the open beta test (OBT) phase. To use it, submit a service ticket.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependency

    gaussdbformysql:serverless:updateScalingPolicy

    Write

    instance *

    • g:EnterpriseProjectId

    • g:ResourceTag/<tag-key>

    gaussdb:serverless:updateScalingPolicy

    -

URI

PUT /v3/{project_id}/instances/{instance_id}/serverless/scaling-policy

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region.

To obtain this value, see Obtaining a Project ID.

Constraints

N/A

Range

The value contains 32 characters. Only letters and digits are allowed.

Default Value

N/A

instance_id

Yes

String

Definition

Instance ID, which uniquely identifies an instance.

Constraints

N/A

Range

The value contains 36 characters with a suffix of in07. Only letters and digits are allowed.

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. To obtain this value, call the IAM API for obtaining a user token.

The value of X-Subject-Token in the response header is the token value.

Constraints

N/A

Range

N/A

Default Value

N/A

Content-Type

Yes

String

Definition

Content type.

Constraints

N/A

Range

application/json

Default Value

application/json

X-Language

No

String

Definition

Request language type.

Constraints

N/A

Range

  • en-us

  • zh-cn

Default Value

en-us

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

enlarge_step_size

No

String

Definition

Custom scale-up step.

Constraints

N/A

Range

The value is between 2 and half of the maximum compute.

Default Value

N/A

custom_scaling_config

No

CustomScalingConfig object

Definition

Custom scale-up policy.

Constraints

N/A

Table 4 CustomScalingConfig

Parameter

Mandatory

Type

Description

enlarge_scene

No

ScalingScene object

Definition

Custom scale-up policy.

Constraints

N/A

Table 5 ScalingScene

Parameter

Mandatory

Type

Description

conditions

No

Array of ScalingCondition objects

Definition

Configuration change conditions.

Constraints

N/A

Table 6 ScalingCondition

Parameter

Mandatory

Type

Description

condition_id

No

String

Definition

Name of a configuration change condition.

Constraints

N/A

Range

The value cannot be empty and contains a maximum of 32 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value

N/A

duration

No

Integer

Definition

Duration, in milliseconds.

Constraints

N/A

Range

2000–5000

Default Value

N/A

interval

No

Integer

Definition

Interval, in milliseconds.

Constraints

N/A

Range

1000–5000

Default Value

N/A

metric_conditions

No

Array of MetricCondition objects

Definition

Conditions for metric reconfiguration.

Constraints

N/A

Table 7 MetricCondition

Parameter

Mandatory

Type

Description

metric_name

No

String

Definition

Metric name.

Constraints

N/A

Range

  • cpuTotalUsage: CPU usage

  • memoryTotalUsage: memory usage

Default Value

N/A

metric_value

No

Integer

Definition

Threshold for metric reconfiguration.

Constraints

The value is 10,000 times the percentage. For example, when the percentage is 50%, the value is 5000.

Range

6000–8000

Default Value

N/A

compare_mode

No

String

Definition

Comparison mode.

Constraints

N/A

Range

GT: greater than

Default Value

N/A

Response Parameters

Status code: 200

Table 8 Response body parameters

Parameter

Type

Description

enlarge_step_size

String

Definition

Custom scale-up step.

Constraints

N/A

Range

The value is between 2 and half of the maximum compute.

Default Value

N/A

custom_scaling_config

CustomScalingConfig object

Definition

Custom scale-up policy.

Constraints

N/A

Table 9 CustomScalingConfig

Parameter

Type

Description

enlarge_scene

ScalingScene object

Definition

Custom scale-up policy.

Constraints

N/A

Table 10 ScalingScene

Parameter

Type

Description

conditions

Array of ScalingCondition objects

Definition

Configuration change conditions.

Constraints

N/A

Table 11 ScalingCondition

Parameter

Type

Description

condition_id

String

Definition

Name of a configuration change condition.

Constraints

N/A

Range

The value cannot be empty and contains a maximum of 32 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value

N/A

duration

Integer

Definition

Duration, in milliseconds.

Constraints

N/A

Range

2000–5000

Default Value

N/A

interval

Integer

Definition

Interval, in milliseconds.

Constraints

N/A

Range

1000–5000

Default Value

N/A

metric_conditions

Array of MetricCondition objects

Definition

Conditions for metric reconfiguration.

Constraints

N/A

Table 12 MetricCondition

Parameter

Type

Description

metric_name

String

Definition

Metric name.

Constraints

N/A

Range

  • cpuTotalUsage: CPU usage

  • memoryTotalUsage: memory usage

Default Value

N/A

metric_value

Integer

Definition

Threshold for metric reconfiguration.

Constraints

The value is 10,000 times the percentage. For example, when the percentage is 50%, the value is 5000.

Range

6000–8000

Default Value

N/A

compare_mode

String

Definition

Comparison mode.

Constraints

N/A

Range

GT: greater than

Default Value

N/A

Status code: 400

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 14 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Request

Setting a custom serverless scale-up policy

PUT https://{endpoint}/v3/056538411200d4cd2f79c003c7606412/instances/c70a7eed50b14ee4969449ab5166aa7bin07/serverless/scaling-policy

{
  "enlarge_step_size" : "2",
  "custom_scaling_config" : {
    "enlarge_scene" : {
      "conditions" : [ {
        "condition_id" : "enlarge-custom-01",
        "metric_conditions" : [ {
          "metric_name" : "cpuTotalUsage",
          "metric_value" : 8000,
          "compare_mode" : "GT"
        } ],
        "duration" : 3000,
        "interval" : 1000
      }, {
        "condition_id" : "enlarge-custom-02",
        "metric_conditions" : [ {
          "metric_name" : "cpuTotalUsage",
          "metric_value" : 6000,
          "compare_mode" : "GT"
        } ],
        "duration" : 5000,
        "interval" : 2000
      }, {
        "condition_id" : "enlarge-custom-03",
        "metric_conditions" : [ {
          "metric_name" : "memoryTotalUsage",
          "metric_value" : 8000,
          "compare_mode" : "GT"
        } ],
        "duration" : 3000,
        "interval" : 2000
      } ]
    }
  }
}

Example Response

Status code: 200

Success.

{ }

Status Code

For details, see Status Codes.

Error Code

For details, see Error Codes.