Create a Cross-Region Peering Connection

Last updated: 2019-11-29 19:44:18

PDF

API Description

This API is used to create cross-region peering connections.
Domain name: vpc.api.qcloud.com
API name: CreateVpcPeeringConnectionEx

  • Cross-region peering connections are used to establish connectivity between VPCs in two different regions. The IP address ranges of both VPCs that need to be interconnected cannot overlap.
  • Cross-account peering connections take effect only when the receiver accepts the request. Peering connections between VPCs in the same account take effect immediately.
  • You can set a bandwidth for cross-region interconnection. For any changes made after the creation of the peering connection, contact customer service.

Request 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 CreateVpcPeeringConnectionEx.

Parameter 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 API.
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 API.
peerUin Yes String The receiver's unique account ID on Tencent Cloud. You can ask the receiver to check this ID in the personal information area of the User Center. For more information, see the Operation Guide.
peeringConnectionName Yes String Peering connection name, which cannot exceed 60 characters.
peerRegion Yes String Receiver's region. For more information about the supported regions, see About Regions.
bandwidth Yes String Upper limit of bandwidth for the peering connection (in Mbps). There is no limit by default.
For more information about the limit, see About Peering Connections
type No Int Interconnection type. The default is 1.
1: Peering connection between VPCs
2: Peering connection between a VPC and a BM network.

Response Parameters

Parameter name Type Description
code Int Error code.
0: Successful
Other values: Failed.
message String Error message.
taskId Int Task ID. You can query the execution result by using taskId.
For more information, see the API for Querying Task Execution Results.

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 IP ranges 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.

Sample Code

Request example

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

Response example

{
    "code":"0",
    "message":"",
    "taskId":112245
}