Updated on 2022-12-12 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

Table 1 lists the specifications to which each instance specification can be changed. Exercise caution when performing this operation. Once the instance specification is changed, it cannot be changed back again.

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.

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

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. If you modify the specifications of a mongos node, the value is mongos. If you modify the specifications of a shard node, the value is shard. If you modify the specifications of a config node, the value is config.
    • This parameter is not transferred for replica set and single node instances.

    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.

    • If you modify the specifications of a mongos node, the value is the mongos node ID. If you modify the specifications of a shard node, the value is the shard node ID. If you modify the specifications of a config node, the value is the config node ID.
    • For a replica set instance, the value is the DB instance 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.

  • Request example
    Modify the mongos node specifications.
    {
      "resize": {
        "target_type": "mongos",
        "target_id": "a742c13a284949adad177672e8a0f01cno02",
        "target_spec_code": "dds.mongodb.c6.large.4.mongos"
      }
    }

    Modify the shard node specifications.

    {
      "resize": {
        "target_type": "shard",
        "target_id": "aeeb40a704904977ad78993d138ec942gr02",
        "target_spec_code": "dds.momgodb.c6.large.4.shard"
      }
    }

    Modify the config node specifications.

    {
      "resize": {
        "target_type": "config",
        "target_id": "10a1c330537b42c1a9b3f7a5ebcda35egr02",
        "target_spec_code": "dds.momgodb.c6.xlarge.2.config"
      }
    }
    Modify 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"
    }

Status Code

For more information, see Status Code.

Error Code

For more information, see Error Code.