Switches the network type of an ApsaraDB for Redis instance. You can switch the network type of an instance from classic network to virtual private cloud (VPC).
For more information about how to perform the corresponding operation in the console, see Switch to VPC network.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | SwitchNetwork |
The operation that you want to perform. Set the value to SwitchNetwork. |
InstanceId | String | Yes | r-bp1zxszhcgatnx**** |
The ID of the instance. |
TargetNetworkType | String | No | VPC |
The network type to which you want to switch. Currently, you can only switch from classic network to VPC. Set this parameter to VPC. |
VpcId | String | No | vpc-bp1nme44gek34slfc**** |
The ID of the VPC where the instance is deployed after you switch the network type of the instance to VPC. Note If you specify this parameter is specified, the VSwitchId parameter is required.
|
RetainClassic | String | No | True |
Specifies whether to retain the classic network endpoint. Valid values:
Note Default value: False.
|
VSwitchId | String | No | vsw-bp1e7clcw529l773d**** |
The ID of the vSwitch in the VPC after you switch the network type of the instance to VPC. |
ClassicExpiredDays | String | No | 30 |
The retention period of the connection address of the classic network. Valid values: 14, 30, 60, and 120. Unit: days. Note
|
RegionId | String | No | cn-hangzhou |
The ID of the region where the instance is deployed. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
TaskId | String | 578678678 |
The ID of the task. |
RequestId | String | F0997EE8-F4C2-4503-9168-85177ED78C70 |
The ID of the request. |
Examples
Sample requests
https://r-kvstore.aliyuncs.com?Action=SwitchNetwork
&InstanceId=r-bp1zxszhcgatnx****
&TargetNetworkType=VPC
&VpcId=vpc-bp1nme44gek34slfc****
&VSwitchId=vsw-bp1e7clcw529l773d****
&RetainClassic=True
&ClassicExpiredDays=30
&<Common request parameters>
Sample success responses
XML
format
<SwitchNetworkResponse>
<TaskId>578678678</TaskId>
<requestId>F0997EE8-F4C2-4503-9168-85177ED78C70</requestId>
</SwitchNetworkResponse>
JSON
format
{
"TaskId":"578678678",
"requestId": "F0997EE8-F4C2-4503-9168-85177ED78C70"
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | InvalidToken.Malformed | The Specified parameter "Token" is not valid. | The error message returned because the token is invalid. |
400 | IzNotSupportVpcError | Specify iz not support vpc. | The error message returned because the specified iz does not support the VPC network. |
400 | IzNotSupportSwitchNetworkError | Specify iz not support switch network. | The error message returned because the specified iz does not support network switching. |
400 | VpcId is wrong. | VpcId is wrong. | The error message returned because the VPC ID is invalid. |
For a list of error codes, visit the API Error Center.