You can call this operation to switch between an internal network and a public network.

You can switch between an internal network and a public network through this operation. An internal network can be switched to a public network, and vice versa. After switching, the connection address changes. You must modify the connection address in the code and restart the application.

This operation must meet the following requirements:

  • The instance has only a private or public IP address.
  • The instance is in the running state.
  • You switch between an internal network and a public network for less than 20 times within 24 hours.
  • The network type of the instance is classic network.
  • Access modesandInstance typesplace the following restrictions on which connection address to choose:
    • The instance type is Single-host Basic Edition. The versions of instances include MySQL 5.7, basic series of SQL Server 2012/2016 Web Edition, basic series of SQL Server 2012 Web Enterprise Edition, and PostgreSQL 10.0. The access mode is standard mode. The connection address can be switched to the private IP address, the public IP address, or the private and public IP addresses.
    • The instance type is Dual-host High-availability Edition. The versions of instances include MySQL 5.5/5.6/5.7, SQL Server 2008 R2, SQL Server 2012/2016 Standard High-availability Edition, SQL Server 2012/2016 Enterprise High-availability Edition, PostgreSQL 9.4, and PPAS 9.3/10.0. The access mode is standard mode. The connection address can be switched to the private IP address or the public IP address.
    • The instance type is Dual-host High-availability Edition. The versions of instances include MySQL 5.5/5.6/5.7, SQL Server 2008 R2, SQL Server 2012/2016 Standard High-availability Edition, SQL Server 2012/2016 Enterprise High-availability Edition, PostgreSQL 9.4, and PPAS 9.3/10.0. The access mode is safe mode. The connection address can be switched to the private IP address, the public IP address or the private and public IP addresses.
    • The instance type is Finance Edition. The versions of instances include MySQL 5.6. The access mode is standard mode. The connection address can be switched to the private IP address or public IP address.
    • The instance type is Finance Edition. The versions of instances include MySQL 5.6. The access mode is safe mode. The connection address can be switched to the private IP address, the public IP address, or the private and public IP addresses.

Debugging

You can use OpenAPI Explorer to perform debugging. OpenAPI Explorer allows you to perform various operations to simplify API usage. For example, you can retrieve APIs, call APIs, and dynamically generate SDK example code.

Request parameters

Parameter Type Required? Example Description
Action String Yes SwitchDBInstanceNetType

The operation that you want to perform. Set this parameter to SwitchDBInstanceNetType.

DBInstanceId String Yes rm-uf6wjk5xxxxxxx

The ID of the instance.

ConnectionStringPrefix String Yes rm-xxxxxx

The prefix of the custom connection address. It must be 8 to 64 characters in length and can contain letters and digits. It must start with a lowercase letter.

ClientToken String No ETnLKlblzczshOTUbOCzxxxxxx

The client token that is used to guarantee the idempotency of requests. The client token is generated by the client and is unique among different requests. It is a string of up to 64 ASCII characters.

Port String No 3306

The port number. Value range: 3001 to 3999

ConnectionStringType String No Normal

The type of the connection address. Valid values:

  • Normal
  • ReadWriteSplitting
Note By default, all types of connections are listed.
AccessKeyId String No LTAIfCxxxxxxx

The AccessKey ID issued by Alibaba Cloud for users to access services.

Response parameters

Parameter Type Example Description
RequestId String 65BDA532-28AF-4122-AA39-B382721EEE64

The ID of the request.

Examples

Sample requests


http(s)://rds.aliyuncs.com/? Action=SwitchDBInstanceNetType
&DBInstanceId=rm-uf6wjk5xxxxxxx 
&ConnectionStringPrefix=rm-xxxxxx
&<Common request parameters>

Successful response examples

XML format

<SwitchDBInstanceNetTypeResponse>
	  <RequestId> 65BDA532-28AF-4122-AA39-B382721EEE64</RequestId></SwitchDBInstanceNetTypeResponse>

JSON format

{
	"RequestId":" 65BDA532-28AF-4122-AA39-B382721EEE64"
}

Error codes

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