You can call the ModifyDBInstanceNetworkType operation to change the network type of an ApsaraDB RDS instance from classic network to virtual private cloud (VPC).
Prerequisites
The network type of the instance is classic network.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ModifyDBInstanceNetworkType |
The operation that you want to perform. Set the value to ModifyDBInstanceNetworkType. |
DBInstanceId | String | Yes | rm-uf6wjk5xxxxxxx |
The ID of the instance. |
RetainClassic | String | No | True |
Specifies whether to retain the classic network endpoint. Valid values:
Default value: False. |
ClassicExpiredDays | String | No | 7 |
The number of days for which you want to retain the classic network endpoint. Valid values: 1 to 120. Default value: 7. Note If you set RetainClassic to True, you must also specify this parameter.
|
InstanceNetworkType | String | Yes | VPC |
The network type after the modification. The value is fixed as VPC. |
ReadWriteSplittingClassicExpiredDays | Integer | No | 7 |
The number of days for which you want to retain the read/write splitting endpoint of the classic network type. Valid values: 1 to 120. Default value: 7. Note This parameter takes effect only when a read/write splitting endpoint of the classic
network type exists and RetainClassic is set to True.
|
VPCId | String | No | vpc-uf6f7l4fg90xxxxxx |
The ID of the VPC. |
VSwitchId | String | No | vsw-uf6adz52c2pxxxxx |
The ID of the vSwitch. This parameter is required if the VPCId parameter is specified. |
PrivateIpAddress | String | No | 172.10.40.25 |
The internal IP address of the instance. The internal IP address must be within the CIDR block supported by the specified vSwitch. ApsaraDB RDS automatically assigns an internal IP address to the instance based on the values of the VPCId and VSwitchId parameters. |
ReadWriteSplittingPrivateIpAddress | String | No | 192.168.0.22 |
The internal IP address that corresponds to the read/write splitting endpoint of the instance. The internal IP address must be within the CIDR block supported by the specified vSwitch. ApsaraDB RDS automatically assigns an internal IP address to the instance based on the values of the VPCId and VSwitchId parameters. Note This parameter is valid when a read/write splitting endpoint of the classic network
type exists.
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 1AD222E9-E606-4A42-BF6D-8A4442913CEF |
The ID of the request. |
TaskId | String | 1025486523574 |
The ID of the task. |
ConnectionString | String | rm-bp1*****************.mysql.rds.aliyuncs.com |
The endpoint that is used to connect to the instance. |
Examples
Sample requests
http(s)://rds.aliyuncs.com/?Action=ModifyDBInstanceNetworkType
&DBInstanceId=rm-bp1*****************.mysql.rds.aliyuncs.com
&InstanceNetworkType=VPC
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<ModifyDBInstanceNetworkTypeResponse>
<RequestId>9F0F1B7B-ED7A-5767-ADA5-46F31121E1D4</RequestId>
<ConnectionString>rm-bp1*****************.mysql.rds.aliyuncs.com</ConnectionString>
</ModifyDBInstanceNetworkTypeResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "9F0F1B7B-ED7A-5767-ADA5-46F31121E1D4",
"ConnectionString" : "rm-bp1*****************.mysql.rds.aliyuncs.com"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | NetTypeExists | Specified network type already exists. | The error message returned because the specified network type is the same as the original network type of the instance. |
400 | VswitchIpExhausted | Vswitch IP exhausted. | The error message returned because vSwitch IP addresses are depleted. |
400 | OperationDenied.Switch | The specified instance must not be switched to VPC. | The error message returned because the instance does not support this operation. |
400 | OperationDenied.DBInstanceNetType | Operation is denied by the network type of current database instance. | The error message returned because the network type of the primary instance does not support this operation. |
400 | OperationDenied.DBInstanceStatus | Operation is denied by the current database instance status. | The error message returned because the operation is not supported when the instance is in the current state. |
403 | OperationDenied.DBInstanceConnType | The current DB instance connection type does not support this operation. | The error message returned because the current network connection type does not support this operation. |
For a list of error codes, visit the API Error Center.