You can call this operation to change the network type of a MongoDB instance.

This operation is applicable to replica set instances and sharded cluster instances. ModifyDBInstanceNetworkType cannot be performed on standalone instances.

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 ModifyDBInstanceNetworkType

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

NetworkType String Yes VPC

The network type to switch to. Valid values:

  • VPC: changes the network type to VPC.
  • Classic: changes the network type to classic network.
DBInstanceId String Yes dds-bpxxxxxxxx

The ID of the instance.

VpcId String No vpc-bpxxxxxxxx

The ID of the VPC.

Note When NetworkType the parameter value is VPC this parameter must be specified when you call the operation.
VSwitchId String No vsw-bpxxxxxxxx

The VSwitch ID of the VPC.

Note When NetworkType the parameter value is VPC this parameter must be specified when you call the operation.
RetainClassic String No True

Indicates whether to retain the original classic network address when you change the network type to VPC. Valid values:

  • True: retains the original classic network address.
  • False: does not retain the original classic network address.
Note
  • This parameter can be specified only when NetworkType is set to VPC.
  • When this parameter is set to True when, you also need to specify the ClassicExpiredDays parameter.
ClassicExpiredDays Integer No 30

The retention period of the original classic network address when you change the network type to VPC. Valid values: 14, 30, 60, and 120. Unit: days.

Note
  • This parameter can be specified only when NetworkType is set to VPC.
  • When RetainClassic the parameter value is True this parameter must be specified when you call the operation.
RegionId String No cn-hangzhou

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

AccessKeyId String No LTAIgbTGpxxxxxx

The AccessKey ID that Alibaba Cloud provides for you to access services.

Response parameters

Prameter Type Sample response Description
RequestId String 7A9807F0-1301-4154-9849-6497E94A04DB

The ID of the request.

Examples

Sample requests


http(s)://mongodb.aliyuncs.com/? Action=ModifyDBInstanceNetworkType
&NetworkType=VPC
&DBInstanceId=dds-bpxxxxxxxx
&VpcId=vpc-bpxxxxxxxx
&VSwitchId=vsw-bpxxxxxxxx
&RetainClassic=True
&ClassicExpiredDays=30
&<Common request parameters>

Sample success response

XML format

<ModifyDBInstanceNetworkTypeResponse>
	  <RequestId>7A9807F0-1301-4154-9849-6497E94A04DB</RequestId>
</ModifyDBInstanceNetworkTypeResponse>

JSON format

{
	"RequestId":"7A9807F0-1301-4154-9849-6497E94A04DB"
}

Error codes.

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