Updated on 2026-08-25 GMT+08:00

Enabling Database Proxy

Function

This API is used to enable database proxy for a DB instance.

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 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

Dependencies

rds:instance:modifyProxy

write

instance

g:EnterpriseProjectId

g:ResourceTag/<tag-key>

-

-

URI

  • URI format

    POST /v3/{project_id}/instances/{instance_id}/proxy/open

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Definition

    Project ID of a tenant in a region.

    To obtain the value, see Obtaining a Project ID.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

    instance_id

    Yes

    Definition

    Instance ID.

    You can obtain the value of this parameter from id in Table 4 by calling the API for querying DB instances.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

Request

Table 2 Parameters

Parameter

Mandatory

Type

Description

flavor_ref

Yes

String

Definition

Specification code of the database proxy.

Constraints

N/A

Range

  • When the site supports the database proxy in primary/standby mode, this parameter does not take effect.
  • When the site supports the database proxy in cluster mode, set this parameter to the value of code in the response body in Querying Database Proxy Specifications.

Default Value

N/A

node_num

Yes

Integer

Definition

Number of database proxy nodes.

Constraints

N/A

Range

  • When the site supports the database proxy in primary/standby mode, set this parameter to 2.
  • When the site supports the database proxy in cluster mode, the minimum value of this parameter is 2. For the maximum value, see the value of max_proxy_node_num in the response body in Querying Database Proxies.

Default Value

N/A

proxy_name

No

String

Definition

Name of the database proxy. Database proxies of the same type can have the same name under the same tenant.

Constraints

N/A

Range

The name must start with a letter and consist of 4 to 64 characters. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.

If this parameter is not specified or the site supports only the database proxy in primary/standby mode, a random name will be generated.

Default Value

N/A

proxy_mode

No

String

Definition

Read/write mode of the database proxy.

Constraints

N/A

Range

  • readwrite: readable and writable
  • readonly: read-only

Default Value

readwrite

route_mode

No

Integer

Definition

Routing policy of the database proxy.

Constraints

N/A

Range

  • 0: weighted
  • 1: load balancing (The primary node does not process read requests.)
  • 2: load balancing (The primary node processes read requests.)

Default Value

N/A

nodes_read_weight

Yes

Array of objects

Definition

Read weights of database nodes. For details, see Table 3.

Constraints

  • If proxy_mode is set to readonly, you need to configure a weight for at least one read replica.
  • If route_mode is set to a value greater than 0, the weight configured for the primary instance does not take effect.

subnet_id

No

String

Definition

Subnet ID in the VPC hosting the DB instance.

Constraints

N/A

Range

To obtain the value, use either of the following methods:

  • Method 1: Log in to the VPC console and click the target subnet on the Subnets page. You can view the network ID on the displayed page.
  • Method 2: Query the network ID through the VPC API. For details, see Querying Subnets.

Default Value

N/A

Table 3 nodes_read_weight field data structure description

Parameter

Mandatory

Type

Description

instance_id

Yes

String

Definition

Instance ID.

Constraints

N/A

Range

Default Value

N/A

weight

Yes

Integer

Definition

Read weight assigned.

Constraints

N/A

Range

1~1000

Default Value

N/A

Example Request

Enable database proxy for a DB instance.

POST https://{Endpoint}/v3/23a50154cf494ec9ad6883979a12db0a/instances/920ec36cef814a8b830a5bed50d9a088in01/proxy/open

{
    "flavor_ref": "rds.proxy.xlarge.2",
    "node_num": 2,
    "proxy_name": "proxy-test",
	"nodes_read_weight": [
        {
            "instance_id": "917c67424dd54af3addf537a069e5b20in01",
            "weight": 1
        }
    ]
}

Response

  • Normal response
    Table 4 Parameters

    Parameter

    Type

    Description

    job_id

    String

    Definition

    Task ID.

    Range

    N/A

    proxy_id

    String

    Definition

    Proxy ID.

    Range

    N/A

  • Example normal response
    { 
       "job_id" : "09908118-8e32-4742-982a-7be194f59e1d",
       "proxy_id": "3ea2d2105f634da2a97ce663597d80dbpo01"
     }
  • Abnormal response

    For details, see Abnormal Response Results.

Status Code

Error Code

For details, see Error Codes.