Create an Intra-Region Peering Connection

Last updated: 2019-11-28 19:49:13

PDF

1. API Description

This API (CreateVpcPeeringConnection) is used to create intra-region peering connections.
Domain name for API requests: vpc.api.qcloud.com

(1) Regional peering connection is used to establish connectivity between VPCs within the same region. The segments of both VPCs that need to interconnected cannot overlap. For more information, see About Peering Connection.
(2) Cross-account peering connections take effect only when the receiver accepts the request. The connections within the same account take effect immediately.
(3) There is no limit on the traffic of intra-region peering connections.
(4) Intra-region peering connections are available for free.

2. Input Parameters

Below is a list of API request parameters. You need to add common request parameters to your request when calling this API.For more information, see the Common Request Parameters page. The Action field for this API is CreateVpcPeeringConnection.

Parameter name Required Type Description
vpcId Yes String VPC ID, which can be the vpcId or unVpcId (recommended). You can query this ID through the API DescribeVpcEx.
peerVpcId Yes String VPC ID of the receiver, which can be the vpcId or unVpcId (recommended). You can query this ID through the API DescribeVpcEx.
peerUin Yes String Receiver's uin.
peeringConnectionName Yes String Peering connection name, which cannot exceed 60 characters.

3. Output Parameters

Parameter name Type Description
code Int Error code. 0: Successful; other values: Failed.
message String Error message.
peeringConnectionId String Peering connection ID assigned by the system, for example: pcx-6gw5wvmk.

4. Error Codes

The following error codes only include business logic error codes for this API. For additional common error codes, see VPC Error Codes.

Error code Description
InvalidPeeringConnectionName Invalid peering connection name. This name cannot exceed 60 characters.
PeeringConnectionVpcConflict A conflict occured between VPC segments in peering connection.
PeeringConnectionLimitExceeded The limit of requested peering connection resources for the specific region has been reached. To request more resources, contact customer service. For more information about VPC resource limits, see VPC Use Limits.
InvalidVpc.NotFound Invalid VPC. This error code indicates that the VPC does not exist. In this case, verify whether the resource information that you entered is correct.

5. Example

Input

https://vpc.api.qcloud.com/v2/index.php?Action=CreateVpcPeeringConnection
&<Common Request Parameters>
&vpcId=gz_vpc_226
&peerVpcId=gz_vpc_89
&peerUin=2407912486
&peeringConnectionName=tses

Output

{
    "code":"0",
    "message":"",
    "peeringConnectionId":"pcx-6gw5wvmk"
}