Updated on 2024-04-02 GMT+08:00

Modifying DB Instance Specifications

API Description

This API is used to modify the instance specifications in the same or different instance series.

Services will be interrupted for 5 to 10 minutes when you modify DB instance specifications. Exercise caution when performing this operation.

Change Rules

Considering the stability and performance of DDS DB instances, you can change the DB instance class according to the rules listed in Table 1. Exercise caution when performing this operation.

Table 1 Change rules

Original Specification

Target Specification

Supported

General-purpose

General-purpose

Enhanced

×

Enhanced II

Enhanced

General-purpose

Enhanced

×

Enhanced II

Enhanced II

General-purpose

×

Enhanced

×

Enhanced II

√ indicates that an item is supported, and × indicates that an item is not supported.

Restrictions

  • This API supports both yearly/monthly and pay-per-use DB instances.
  • If you want to change the specifications to other specifications of the same series, the new specifications cannot be the same as the original specifications.
  • Specifications can be modified only when the DB instance status is normal.
  • The specifications of read replicas in a cluster instance cannot be changed.

URI

  • URI format

    POST https://{Endpoint}/v3/{project_id}/instances/{instance_id}/resize

  • URI example

    https://dds.ap-southeast-1.myhuaweicloud.com/v3/0549b4a43100d4f32f51c01c2fe4acdb/instances/9136fd2a9fcd405ea4674276ce36dae8in02/resize

Table 2 Request parameters

Name

Type

IN

Mandatory

Description

X-Auth-Token

string

header

Yes

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

project_id

string

path

Yes

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

instance_id

string

path

Yes

Instance ID, which can be obtained by calling the API described in Querying Instances and Details. If you do not have an instance, call the API described in Creating a DB Instance to create one.

Requests

  • Parameter description
    Table 3 Parameter description

    Name

    Type

    Mandatory

    Description

    resize

    Object

    Yes

    The specification information. For more information, see Table 4.

    is_auto_pay

    Boolean

    No

    Whether the order is automatically paid from your account when you change the class of a yearly/monthly DB instance. This parameter does not affect the payment mode of automatic renewal.

    • This parameter is invalid when the instance class is scaled down.
    • When the instance class is scaled up, this parameter can be set to:
      • true: indicates that the order is automatically paid from the account.
      • false: indicates that the order is manually paid from the account. The default value is false.
    Table 4 Data structure description of the resize field

    Name

    Type

    Mandatory

    Description

    target_type

    String

    No

    The object type:

    • This parameter is mandatory for a cluster instance. To change the specifications of a mongos node, set this parameter to mongos. To change the specifications of a single shard or multiple shards in batches, set this parameter to shard. To change the specifications of a config node, set this parameter to config.
    • This parameter is not specified for replica set instances. If you modify the specifications of a read replica, the value is readonly.
    • This parameter is not specified for single node instances.
    • Enumerated values:
      • mongos
      • shard
      • config
      • readonly

    target_id

    String

    Yes

    The ID of the node or instance whose specifications are to be modified. You can obtain the ID by calling the API used for querying instances. If you do not have an instance, you can call the API used for creating an instance.

    • For a cluster instance, when you change the specifications of a mongos node, the value is the mongos node ID. When you change the specifications of a single shard group, the value is the shard group ID. When you change the specifications of multiple shard groups in batches, this parameter is not specified. When you change the specifications of a config group, the value is the config group ID.
    • For a replica set instance, the value is the DB instance ID. If you modify the specifications of a read replica, the value is the read replica ID.
    • For a single node instance, the value is the DB instance ID.

    target_spec_code

    String

    Yes

    The resource specification code of the new specification. For details about how to obtain the value, see the response values of flavors.spec_code in Querying Database Specifications.

Example Request

  • Modifying the mongos specifications in a cluster instance
    {
      "resize": {
        "target_type": "mongos",
        "target_id": "a742c13a284949adad177672e8a0f01cno02",
        "target_spec_code": "dds.mongodb.c6.large.4.mongos"
      }
    }
  • Modifying the shard specifications in a cluster instance
    {
      "resize": {
        "target_type": "shard",
        "target_id": "aeeb40a704904977ad78993d138ec942gr02",
        "target_spec_code": "dds.momgodb.c6.large.4.shard"
      }
    }
  • Modifying the config specifications in a cluster instance
    {
      "resize": {
        "target_type": "config",
        "target_id": "10a1c330537b42c1a9b3f7a5ebcda35egr02",
        "target_spec_code": "dds.momgodb.c6.xlarge.2.config"
      }
    }
  • Modifying specifications of a replica set or a single node instance
    {
      "resize": {
        "target_id": "aeeb40a704904977ad78993d138ec942in02",
        "target_spec_code": "dds.mongodb.c6.medium.4.repset"
      }
    }

Responses

  • Parameter description
    Table 5 Parameter description

    Name

    Type

    Mandatory

    Description

    job_id

    String

    Yes

    The task ID.

    order_id

    String

    No

    The order ID. This parameter is returned only when the specifications of a yearly/monthly DB instance are changed.

  • Response example
    {
        "job_id": "3711e2ad-5787-49bc-a47f-3f0b066af9f5"
    }

SDK

Click Document Database Service DDS SDK to download the SDK or view the SDK document. To learn how to install and authenticate an SDK, read the Usage section.

Status Code

For more information, see Status Code.

Error Code

For more information, see Error Code.