All Products
Search
Document Center

Tair (Redis® OSS-Compatible):SwitchNetwork

Last Updated:Aug 28, 2026

Changes the VPC or vSwitch of a Tair (Redis OSS-compatible) instance. If the instance uses the classic network, the network type is switched to VPC.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

kvstore:SwitchNetwork

update

*DBInstance

acs:kvstore:{#regionId}:{#accountId}:instance/{#instanceId}

None None

Request parameters

Parameter

Type

Required

Description

Example

TargetNetworkType

string

No

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

VPC

VpcId

string

No

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

Note
  • The VPC and the instance must be deployed in the same region.

  • After you set this parameter, you must also set the VSwitchId parameter.

vpc-bp1nme44gek34slfc****

VSwitchId

string

No

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

Note

The vSwitch and the instance must be deployed in the same zone.

vsw-bp1e7clcw529l773d****

InstanceId

string

Yes

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

r-bp1zxszhcgatnx****

RetainClassic

string

No

Whether to retain the original classic network endpoint after the instance is switched from classic network to VPC. Default value: False. Valid values:

  • True: retains the classic network endpoint.

  • False: does not retain the classic network endpoint.

Note

This parameter is available only when the network type of the instance is classic network.

True

ClassicExpiredDays

string

No

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

Note
  • This parameter is available and required only when the RetainClassic parameter is set to True.

  • After the switchover, you can also call the ModifyInstanceNetExpireTime operation to modify the retention period of the classic network endpoint.

30

Response elements

Element

Type

Description

Example

object

TaskId

string

The ID of the task.

578678678

RequestId

string

The ID of the request.

F0997EE8-F4C2-4503-9168-85177ED78C70

Examples

Success response

JSON format

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

Error response

JSON format

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

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidToken.Malformed The Specified parameter Token is not valid.
400 VpcServiceError Invoke vpc service failed.
400 IzNotSupportVpcError Specify iz not support vpc.
400 IzNotSupportSwitchNetworkError Specify iz not support switch network.
400 VpcVerifyError VpcId is wrong.
400 VpcAndVSwitchNotChange VpcId and vSwitchId not change. The VpcId and vSwitchId parameter values are not changed.
403 ResourceAlreadyExists Resource already exists.
403 InsufficientResourceCapacity ip resource is conflict with other custins.
403 VpcFreePasswordNoSupport The custins opend VPCFreePassword not support this operation. This operation is not supported for the instance because the VPC secret exemption is enabled or the# no_loose_check-whitelist-always parameter is set to no at the same time.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.