Switches the network type of an ApsaraDB for Redis instance from classic network to Virtual Private Cloud (VPC).

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 SwitchNetwork

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

InstanceId String Yes r-bp1zxszhcgatnx****

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

VpcId String Yes vpc-bp1nme44gek34slfc****

The ID of the VPC to which that you want to switch. You can call the DescribeVpcs operation to query VPC IDs.

Note
  • The VPC and the ApsaraDB for Redis instance must be deployed in the same region.
  • After you set this parameter, you must also set the VSwitchId parameter.
VSwitchId String Yes vsw-bp1e7clcw529l773d****

The ID of the vSwitch that belongs to the VPC to which you want to switch. You can call the DescribeVpcs operation to query VPC IDs.

Note The vSwitch and the ApsaraDB for Redis instance must belong to the same zone.
TargetNetworkType String No VPC

The network type to which you want to switch. Set the value to VPC.

RetainClassic String No True

Specifies whether to retain the original endpoint for the classic network after you switch the instance from classic network to VPC. Valid values:

  • True: retains the original endpoint.
  • False: does not retain the original endpoint. This is the default value.
Note This parameter can be used only when the network type of the instance is classic network.
ClassicExpiredDays String No 30

The retention period of the endpoint for the classic network. Valid values: 14, 30, 60, and 120. Unit: days.

Note
  • This parameter is required when RetainClassic is set to True.
  • After you complete the switchover operation, you can also call the ModifyInstanceNetExpireTime operation to modify the retention period of the endpoint for the classic network.
RegionId String No cn-hangzhou

The ID of the region to which the instance belongs. You can call the DescribeInstances operation to query region IDs.

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 IzNotSupportVpcError Specify iz not support vpc. The error message returned because the specified iz does not support VPC.
400 IzNotSupportSwitchNetworkError Specify iz not support switch network. The error message returned because the specified iz does not support network switching.

For a list of error codes, visit the API Error Center.