Creates a virtual private cloud (VPC) peering connection.
Usage notes
Before you create a VPC peering connection, make sure that the following requirements are met:
- Cloud Data Transfer (CDT) is activated to manage the billing of intra-border data transfers. To activate CDT, call the OpenCdtService operation.
- The CreateVpcPeerConnection operation is asynchronous. After you send a request, the system returns InstanceId, but the operation is still being performed in the background. You can call the GetVpcPeerConnectionAttribute operation to query the status of a VPC peering connection.
- If a VPC peering connection is in the Creating state, the VPC peering connection is being created.
- If a VPC peering connection is in the Activated state, the VPC peering connection is created.
- If a VPC peering connection is in the Accepting state, the VPC peering connection is created across accounts and the acceptor is accepting the VPC peering connection.
- You cannot repeatedly call the CreateVpcPeerConnection operation for the same VPC within the specified period of time.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateVpcPeerConnection |
The operation that you want to perform. Set the value to CreateVpcPeerConnection. |
RegionId | String | Yes | cn-hangzhou |
The ID of the region where you want to create a VPC peering connection. You can call the DescribeRegions operation to query the most recent region list. |
VpcId | String | Yes | vpc-bp1gsk7h12ew7oegk**** |
The ID of the requester VPC. |
AcceptingAliUid | Long | Yes | 1210123456123456 |
The ID of the Alibaba Cloud account to which the acceptor VPC belongs.
|
AcceptingRegionId | String | Yes | cn-hangzhou |
The region ID of the acceptor VPC of the VPC peering connection that you want to create.
|
AcceptingVpcId | String | Yes | vpc-bp1vzjkp2q1xgnind**** |
The ID of the acceptor VPC. |
Name | String | No | vpcpeer |
The name of the VPC peering connection. The name must be 2 to 128 characters in length and can contain digits, underscores (_), and hyphens (-). It must start with a letter. |
Description | String | No | description |
The description of the VPC peering connection. The description must be 2 to 256 characters in length. The description must start
with a letter but cannot start with |
DryRun | Boolean | No | false |
Specifies whether to check the request without performing the operation. Valid values:
|
ClientToken | String | No | 02fb3da4-130e-11e9-8e44-001**** |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. Note If you do not set this parameter, the system uses RequestId as ClientToken. RequestId may be different for each API request.
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 54B48E3D-DF70-471B-AA93-08E683A1B45 |
The ID of the request. |
InstanceId | String | pcc-lnk0m24khwvtkm**** |
The ID of the VPC peering connection. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=CreateVpcPeerConnection
&RegionId=cn-hangzhou
&VpcId=vpc-bp1gsk7h12ew7oegk****
&AcceptingAliUid=1210123456123456
&AcceptingRegionId=cn-hangzhou
&AcceptingVpcId=vpc-bp1vzjkp2q1xgnind****
&Name=vpcpeer
&Description=description
&DryRun=false
&ClientToken=02fb3da4-130e-11e9-8e44-001****
&Common request parameters
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateVpcPeerConnectionResponse>
<RequestId>54B48E3D-DF70-471B-AA93-08E683A1B45</RequestId>
<InstanceId>pcc-lnk0m24khwvtkm****</InstanceId>
</CreateVpcPeerConnectionResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "54B48E3D-DF70-471B-AA93-08E683A1B45",
"InstanceId" : "pcc-lnk0m24khwvtkm****"
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | OperationFailed.CdtNotOpened | The operation failed because the Cdt service is not opened. | The error message returned because CDT is not activated and the operation failed. |
400 | ResourceAlreadyExist.RouterInterface | The specified resource of %s already exists. | The error message returned because the specified router interface already exists. |
400 | ResourceAlreadyExist.VpcPeer | The specified resource of %s already exists. | The error message returned because the specified VPC peering connection already exists. |
400 | UnsupportedRegion | The feature of %s is not supported in the region of %s. | The error message returned because VPC peering connections are not supported in this region. |
For a list of error codes, see Service error codes.