调用ModifyDBInstanceNetworkType接口将网络类型为经典网络的RDS实例转换为专有网络。
前提条件
RDS实例的网络类型为经典网络。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | ModifyDBInstanceNetworkType |
系统规定参数。取值:ModifyDBInstanceNetworkType。 |
DBInstanceId | String | 是 | rm-uf6wjk5xxxxxxx |
实例ID。 |
RetainClassic | String | 否 | True |
是否保留经典网络地址,取值:
默认值:False。 |
ClassicExpiredDays | String | 否 | 7 |
经典网络地址保留的天数,取值1-120,单位:天。默认值:7。 说明 若传入参数RetainClassic=True,则该参数必传。
|
InstanceNetworkType | String | 是 | VPC |
目标网络类型,取值固定为VPC:专有网络。 |
ReadWriteSplittingClassicExpiredDays | Integer | 否 | 7 |
读写分离的经典网络地址保留的天数,取值1-120,单位:天。默认值:7。 说明 当实例存在经典网络类型的读写分离地址,且RetainClassic=True,本参数有效。
|
VPCId | String | 否 | vpc-uf6f7l4fg90xxxxxx |
VPC ID。 |
VSwitchId | String | 否 | vsw-uf6adz52c2pxxxxx |
交换机ID,若传入VPCId,则该参数必传。 |
PrivateIpAddress | String | 否 | 172.10.40.25 |
设置实例的内网IP,需要在指定交换机的IP地址范围内。系统默认通过VPCId和VSwitchId自动分配。 |
ReadWriteSplittingPrivateIpAddress | String | 否 | 192.168.0.22 |
设置实例的内网读写分离地址的IP,需要在指定交换机的IP地址范围内。系统默认通过VPCId和VSwitchId自动分配。 说明 当前实例存在经典网络类型的读写分离地址时,该值有效。
|
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
RequestId | String | 1AD222E9-E606-4A42-BF6D-8A4442913CEF |
请求ID。 |
TaskId | String | 1025486523574 |
任务ID。 |
ConnectionString | String | rm-bp1*****************.mysql.rds.aliyuncs.com |
实例连接地址。 |
示例
请求示例
http(s)://rds.aliyuncs.com/?Action=ModifyDBInstanceNetworkType
&DBInstanceId=rm-bp1*****************.mysql.rds.aliyuncs.com
&InstanceNetworkType=VPC
&<公共请求参数>
正常返回示例
XML
格式
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
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "9F0F1B7B-ED7A-5767-ADA5-46F31121E1D4",
"ConnectionString" : "rm-bp1*****************.mysql.rds.aliyuncs.com"
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | NetTypeExists | Specified network type already exists. | 网络类型切换失败,当前网络类型已经存在。 |
400 | VswitchIpExhausted | Vswitch IP exhausted. | 操作失败,vSwitch IP耗尽。 |
400 | OperationDenied.Switch | The specified instance must not be switched to VPC. | 操作失败,当前实例不支持切换至专有网络。 |
400 | OperationDenied.DBInstanceNetType | Operation is denied by the network type of current database instance. | 操作失败,数据库实例的网络类型不支持此操作。 |
400 | OperationDenied.DBInstanceStatus | Operation is denied by the current database instance status. | 操作失败,当前数据库实例状态不支持。 |
403 | OperationDenied.DBInstanceConnType | The current DB instance connection type does not support this operation. | 操作失败,当前的网络连接类型不支持该操作。 |
访问错误中心查看更多错误码。