Help Center/ Document Database Service/ API Reference/ APIs V3.0 (Recommended)/ DB Instance Management/ Configuring an Autoscaling Policy for Storage Space
Updated on 2025-08-22 GMT+08:00

Configuring an Autoscaling Policy for Storage Space

Function

This API is used to configure an autoscaling policy for storage space.

Restrictions

  • For yearly/monthly instances, the system bills new storage space automatically by default. Autoscaling is available only when your account balance is sufficient.
  • Replica set and cluster instances with read replicas do not support this function.

URI

  • URI format

    PUT https://{Endpoint}/v3/{project_id}/instances/auto-enlarge-volume-policies

  • URI example

    https://dds.cn-north-1.myhuaweicloud.com/v3/619d3e78f61b4be68bc5aa0b59edcf7b/instances/auto-enlarge-volume-policies

    Table 1 Path parameters

    Name

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Definition

    Project ID of a tenant in a region. To obtain the project ID, see Obtaining a Project ID.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

Request Parameters

Table 2 Request header parameters

Name

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token obtained from IAM. For details, see Authentication.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 3 Request body parameters

Name

Type

Mandatory

Description

switch_option

String

No

Definition

Whether to enable autoscaling.

Constraints

N/A

Range

  • on: Autoscaling will be enabled for storage space.
  • off: Autoscaling will be disabled for storage space.

Default Value

The default value is on.

policies

Array of objects

Yes

Definition

Autoscaling policies for storage space.

Constraints

You can set autoscaling policies for up to 10 instances. For details, see Table 4.

Range

N/A

Default Value

N/A

Table 4 DiskAutoExpansionPolicy

Name

Type

Mandatory

Description

instance_id

String

Yes

Definition

DB instance ID.

Constraints

N/A

Range

N/A

Default Value

N/A

threshold

Integer

No

Definition

Threshold to trigger autoscaling. If the used storage exceeds this threshold, autoscaling is triggered. The value can be 80, 85, or 90. The default threshold is 90, indicating that autoscaling is enabled when the used storage space exceeds 90% of total storage space. This parameter of a cluster instance applies to each shard in the instance.

Constraints

Only 80, 85, and 90 are supported.

Range

80, 85, and 90

Default Value

90

step

Integer

No

Definition

Autoscaling increment (s%). The value can be 10, 15, or 20, and the default value is 10. After autoscaling is triggered, your storage will automatically scale up by s% (in increments of 10 GB) of your allocated storage. If your account balance is insufficient, autoscaling will fail.

Constraints

Only 10, 15, and 20 are supported.

Range

10, 15, and 20

Default Value

10

size

No

Integer

Definition

Maximum capacity of auto scaling. When the maximum capacity is reached, auto scaling is not triggered.

Constraints

The value must be an integer multiple of 10.

Range

  • The minimum value is the storage space of the current instance plus 10 GB.
  • If an instance has fewer than 8 vCPUs, the maximum storage is 5,000 GB.
  • If an instance has 8 or more vCPUs, the maximum storage is 10,000 GB.

Default Value

If an instance has fewer than 8 vCPUs, the maximum storage is 5,000 GB. If an instance has 8 or more vCPUs, the maximum storage is 10,000 GB.

Response Parameters

Status code: 400

Table 5 Response body parameters

Name

Type

Description

error_code

String

Definition

Error code.

Range

N/A

error_msg

String

Definition

Error message

Range

N/A

Status code: 500

Table 6 Response body parameters

Name

Type

Description

error_code

String

Definition

Error code.

Range

N/A

error_msg

String

Definition

Error message

Range

N/A

Status code: default

Table 7 Response body parameters

Name

Type

Description

error_code

String

Definition

Error code.

Range

N/A

error_msg

String

Definition

Error message

Range

N/A

Example Request

Configure an autoscaling policy for the instance whose ID is 93e4b3eda14349b1b870f72829bc3b9bin02. Set the threshold for triggering autoscaling to 90% and the autoscaling increment to 10%.

PUT https://{endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/instances/auto-enlarge-volume-policies

{ 
"switch_option" : "on",
"policies" : [ { 
  "instance_id" : "93e4b3eda14349b1b870f72829bc3b9bin02", 
  "threshold" : 90, 
  "step" : 10, 
  "size" : 3000 
 } ] 
}

Disable autoscaling for the instance whose ID is 93e4b3eda14349b1b870f72829bc3b9bin02.

PUT https://{endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/instances/auto-enlarge-volume-policies

{ 
  "policies" : [ { 
    "instance_id" : "93e4b3eda14349b1b870f72829bc3b9bin02" 
  } ], 
  "switch_option" : "off" 
}

Example Response

None

Status Code

Status Code

Description

200

OK.

400

Client error.

500

Server error.

default

Client or server error.

Error Code

For details, see Error Code.