You can call the ModifyDBProxy operation to enable or disable the database proxy feature of an instance.

  • The dedicated proxy feature of ApsaraDB RDS for MySQL provides capabilities such as read/write splitting and short-lived connection optimization. For more information, see What are database proxies?
  • The database proxy feature of ApsaraDB RDS for PostgreSQL supports read/write splitting. For more information, see What are database proxies?

Before you call this operation, make sure that the following requirements are met:

If the instance runs MySQL, the instance must run one of the following MySQL versions and RDS editions:

  • MySQL 8.0 with a minor engine version of 20191204 or later on RDS Enterprise Edition
  • MySQL 8.0 with a minor engine version of 20190915 or later on RDS High-availability Edition
  • MySQL 5.7 with a minor engine version of 20191128 or later on RDS Enterprise Edition
  • MySQL 5.7 with a minor engine version of 20190925 or later on RDS High-availability Edition
  • MySQL 5.6 with a minor engine version of 20200229 or later on RDS High-availability Edition

If the instance runs PostgreSQL, the instance must meet the following requirements:

  • The instance runs PostgreSQL 10, PostgreSQL 11, PostgreSQL 12, PostgreSQL 13, PostgreSQL 14, or PostgreSQL 15.
  • The instance uses standard SSDs or enhanced SSDs (ESSDs).
  • The instance runs RDS High-availability Edition.
  • The instance is a primary instance.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ModifyDBProxy

The operation that you want to perform. Set the value to ModifyDBProxy.

DBInstanceId String Yes rm-uf6wjk5xxxxxxx

The ID of the instance. You can call the DescribeDBInstances operation to query the ID of the instance.

ConfigDBProxyService String Yes Startup

Specifies whether to enable or disable the database proxy feature. Valid values:

  • Startup: enables the database proxy feature.
  • Shutdown: disables the database proxy feature.
DBProxyInstanceNum String No 1

The number of proxy instances that are enabled. Valid values: 1 to 60. Default value: 1.

Note The capability of the database proxy to process requests increases with the number of proxy instances that are enabled. You can monitor the load on the instance and specify an appropriate number of proxy instances based on the load monitoring data.
RegionId String No cn-hangzhou

The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list.

InstanceNetworkType String No VPC

The network type of the instance. Set the value to VPC.

Note This parameter is required when you enable the database proxy feature for RDS instances that run MySQL with standard SSDs or ESSDs and RDS instances that run PostgreSQL.
VPCId String No vpc-xxxxxxxxxxxx

The ID of the virtual private cloud (VPC) to which the instance belongs. You can call the DescribeDBInstanceAttribute operation to query the VPC ID of the instance.

Note This parameter is required when you enable the database proxy feature for RDS instances that run MySQL with standard SSDs or ESSDs and RDS instances that run PostgreSQL.
VSwitchId String No vsw-xxxxxxxxxxxx

The vSwitch ID of the instance. You can call the DescribeDBInstanceAttribute operation to query the vSwitch ID of the instance.

Note This parameter is required when you enable the database proxy feature for RDS instances that run MySQL with standard SSDs or ESSDs and RDS instances that run PostgreSQL.
DBProxyEngineType String No normal

An internal parameter. You do not need to specify this parameter.

ResourceGroupId String No rg-acfmy*****

The ID of the resource group.

Response parameters

Parameter Type Example Description
RequestId String FC452BB1-EED8-4278-95C7-0324B3710DF1

The ID of the request.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=ModifyDBProxy
&DBInstanceId=rm-uf6wjk5xxxxxxx
&ConfigDBProxyService=Startup
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ModifyDBProxyResponse>
  <RequestId>FC452BB1-EED8-4278-95C7-0324B3710DF1</RequestId>
</ModifyDBProxyResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "FC452BB1-EED8-4278-95C7-0324B3710DF1"
}

Error codes

HTTP status code Error code Error message Description
400 MaxscaleAlreadyExist The Maxscale is already existed. The error message returned because MaxScale already exists.
400 MaxscaleNotSupport Maxscale not supported The error message returned because the instance does not support the dedicated proxy feature. You must check the dedicated proxy configuration that you specified.
400 NetWork.NotFound NetWork.NotFound The error message returned because the network is unavailable.
400 InvalidVpcParameter Either VPC ID or vSwitch ID is incorrect. Please check again. The error message returned because the VPC ID that you specified is invalid.
400 MaxscaleInternalError Database proxy status is CLASS_CHANGING. The error message returned because the specifications of the database proxy are being changed. Try again later.
400 InvalidDBInstanceName Specified parameter DBInstanceName is not valid. The error message returned because the value of the DBInstanceName parameter is invalid. Check whether the value is null or an empty string.
404 Maxscale.NotFound The relative maxscale instance is not found. The error message returned because the associated MaxScale instances cannot be found.
404 InvalidVSwitchId.NotFound The specified VSwitch is invalid. The error message returned because the vSwitch ID that you specified is invalid.

For a list of error codes, see Service error codes.