All Products
Search
Document Center

Tair:SwitchNetwork

Last Updated:Feb 20, 2024

Changes the virtual private cloud (VPC) or vSwitch of an ApsaraDB for Redis instance. If the instance is deployed in the classic network, the network type of the instance is changed from the classic network to VPC.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
kvstore:SwitchNetworkWRITE
  • DBInstance
    acs:kvstore:{#regionId}:{#accountId}:instance/{#instanceId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
TargetNetworkTypestringNo

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

Enumeration Value:
  • CLASSIC
  • VPC
VPC
VpcIdstringYes

The ID of the VPC to which 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.
  • vpc-bp1nme44gek34slfc****
    VSwitchIdstringYes

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

    Note The vSwitch and the ApsaraDB for Redis instance must belong to the same zone.
    vsw-bp1e7clcw529l773d****
    InstanceIdstringYes

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

    r-bp1zxszhcgatnx****
    RetainClassicstringNo

    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.
    True
    ClassicExpiredDaysstringNo

    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.
  • 30

    Response parameters

    ParameterTypeDescriptionExample
    object
    TaskIdstring

    The ID of the task.

    578678678
    RequestIdstring

    The ID of the request.

    F0997EE8-F4C2-4503-9168-85177ED78C70

    Examples

    Sample success responses

    JSONformat

    {
      "TaskId": "578678678",
      "RequestId": "F0997EE8-F4C2-4503-9168-85177ED78C70"
    }

    Error codes

    HTTP status codeError codeError messageDescription
    400InvalidToken.MalformedThe Specified parameter Token is not valid.-
    400VpcServiceErrorInvoke vpc service failed.-
    400IzNotSupportVpcErrorSpecify iz not support vpc.The specified iz does not support VPCs.
    400IzNotSupportSwitchNetworkErrorSpecify iz not support switch network.The specified iz does not support network switching.
    400VpcVerifyErrorVpcId is wrong.-
    403ResourceAlreadyExistsResource already exists.-
    403InsufficientResourceCapacityip resource is conflict with other custins.-

    For a list of error codes, visit the Service error codes.

    Change history

    Change timeSummary of changesOperation
    2023-07-20API Description Update. The Error code has changedsee changesets
    Change itemChange content
    API DescriptionAPI Description Update.
    Error CodesThe Error code has changed.
      delete Error Codes: 400
      delete Error Codes: 403