Creates a virtual private cloud (VPC) peering connection.
Operation description
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.
-
CreateVpcPeerConnection is an asynchronous operation. After a request is sent, the system returns a request ID and an instance ID and runs the task in the background. You can call the GetVpcPeerConnectionAttribute operation to query the status of the task.
- 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 accepter is accepting the VPC peering connection.
-
You cannot repeatedly call the CreateVpcPeerConnection operation within a specific period of time.
Debugging
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | 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. | cn-hangzhou |
VpcId | string | Yes | The ID of the requester VPC. | vpc-bp1gsk7h12ew7oegk**** |
AcceptingAliUid | long | Yes | The ID of the Alibaba Cloud account to which the accepter VPC belongs.
Note
If the accepter is a RAM user, set AcceptingAliUid to the ID of the Alibaba Cloud account that created the RAM user.
| 1210123456123456 |
AcceptingRegionId | string | Yes | The region ID of the accepter VPC of the VPC peering connection that you want to create.
| cn-hangzhou |
AcceptingVpcId | string | Yes | The ID of the accepter VPC. | vpc-bp1vzjkp2q1xgnind**** |
Name | string | No | 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. | vpcpeer |
Description | string | No | 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 | description |
DryRun | boolean | No | Specifies whether to perform only a dry run, without performing the actual request. Valid values:
| false |
ClientToken | string | No | The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. Note
If you do not specify this parameter, the system automatically uses the request ID as the client token. The request ID may be different for each request.
| 02fb3da4-130e-11e9-8e44-001**** |
ResourceGroupId | string | No | The ID of the resource group. For more information about resource groups, see Resource groups. | rg-acfmxazb4ph6aiy**** |
Bandwidth | integer | No | The bandwidth of the VPC peering connection. Unit: Mbit/s. The value must be an integer greater than 0. Before you specify this parameter, make sure that you create an inter-region VPC peering connection. | 100 |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "54B48E3D-DF70-471B-AA93-08E683A1B45",
"InstanceId": "pcc-lnk0m24khwvtkm****"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | OperationFailed.CdtNotOpened | The operation failed because the Cdt service is not opened. | The operation failed because CDT is not activated. |
400 | OperationFailed.CrossBorderCdtNotOpened | The operation failed because the CrossBorderCdt service is not opened. | - |
400 | IncorrectStatus.Vpc | The status of %s [%s] is incorrect. | - |
400 | IncorrectStatus.AcceptingVpc | The status of %s [%s] is incorrect. | - |
400 | ResourceAlreadyExist.RouterInterface | The specified resource of %s already exists. | The specified router interface already exists. |
400 | ResourceAlreadyExist.VpcPeer | The specified resource of %s already exists. | The specified VPC peering connection already exists. |
400 | OperationDenied.CloudBoxExistsInVpc | The operation is not allowed because the CloudBox device exists in vpc. | - |
400 | OperationDenied.CloudBoxExistsInAcceptingVpc | The operation is not allowed because the CloudBox device exists in accepting vpc. | - |
400 | QuotaExceeded.VpcPeerCountPerVpc | The quota of %s is exceeded, usage %s/%s. | The number of VPC peering connections to the VPC has reached the upper limit. |
400 | UnsupportedRegion | The feature of %s is not supported in the region of %s. | VPC peering connections are not supported in this region. |
400 | UnsupportedFeature.VpcPeer | The feature of %s is not supported. | - |
400 | QuotaExceeded.VpcPeerCountPerUserPerRegion | The quota of %s is exceeded, usage %s/%s. | - |
400 | IncorrectBusinessStatus.VpcPeer | The business status of %s [%s] is incorrect. | - |
400 | OperationFailed.NotExist.ResourceGroup | The operation failed because the resource group does not exist. | The operation failed because the resource group does not exist. |
400 | OperationFailed.AcceptUserCdtNotOpened | The operation failed because the Cdt service of accept user is not opened. | The operation failed because CDT is not activated for the peer. |
400 | OperationFailed.AcceptUserCrossBorderCdtNotOpened | The operation failed because the CrossBorderCdt service of accept user is not opened. | The operation failed because the cross-border service of CDT is not activated for the peer. |
400 | IncorrectBusinessStatus.AcceptUserVpcPeer | The business status of %s [%s] is incorrect. | The peer VPC is in an invalid business state. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
2024-02-28 | The Error code has changed | see changesets | ||||||||||
| ||||||||||||
2023-11-20 | API Description Update. The Error code has changed. The request parameters of the API has changed | see changesets | ||||||||||
| ||||||||||||
2023-05-30 | The Error code has changed. The request parameters of the API has changed | see changesets | ||||||||||
|