调用CreateVpcPeerConnection接口创建VPC对等连接。
接口说明
创建 VPC 对等连接前,您需要完成以下事项:
- CreateVpcPeerConnection 接口属于异步接口,即系统会先返回一个 InstanceId,但该 VPC 对等连接实例并未创建完成,系统后台的创建任务仍在进行。您可以调用 GetVpcPeerConnectionAttribute 查询 VPC 对等连接的状态。
当 VPC 对等连接处于 Creating 状态时,表示 VPC 对等连接正在创建中。
当 VPC 对等连接处于 Activated 状态时,表示 VPC 对等连接创建完成。
当 VPC 对等连接处于 Accepting 状态时,为跨账号场景,跨账号场景需要在接收端接收。
CreateVpcPeerConnection 接口不支持在同一个 VPC 下并发创建 VPC 对等连接。
创建 VPC 对等连接时,系统会为您自动开通非跨境云数据传输 CDT(Cloud DataTransfer)和跨境 CDT 功能。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
vpc:CreateVpcPeerConnection |
create |
*全部资源
|
无 | 无 |
请求参数
名称 |
类型 |
必填 |
描述 |
示例值 |
RegionId |
string |
是 |
需要创建 VPC 对等连接的地域 ID。 您可以通过调用 DescribeRegions 接口获取地域 ID。 |
cn-hangzhou |
VpcId |
string |
是 |
需要创建 VPC 对等连接发起端的 VPC ID。 |
vpc-bp1gsk7h12ew7oegk**** |
AcceptingAliUid |
integer |
是 |
需要创建的 VPC 对等连接接收端的阿里云账号(主账号)ID。
说明
如果接收端的账号为 RAM 用户(子账号),则 AcceptingAliUid 需要输入该 RAM 用户对应的阿里云账号 ID。 |
1210123456123456 |
AcceptingRegionId |
string |
是 |
需要创建的 VPC 对等连接接收端的地域 ID。
|
cn-hangzhou |
AcceptingVpcId |
string |
是 |
VPC 对等连接接收端的 VPC ID。 |
vpc-bp1vzjkp2q1xgnind**** |
Name |
string |
否 |
需要创建的 VPC 对等连接名称。 名称长度为 2~128 个字符,以英文字母或中文开头,可包含数字、下划线(_)和短划线(-)。 |
vpcpeer |
Description |
string |
否 |
需要创建的 VPC 对等连接描述信息。 长度为 2~256 个字符,必须以字母或中文开头,但不能以 |
description |
DryRun |
boolean |
否 |
是否只预检此次请求。取值:
|
false |
ClientToken |
string |
否 |
客户端 Token,用于保证请求的幂等性。 由客户端生成该参数值,要保证在不同请求间唯一,最大值不超过 64 个 ASCII 字符。 说明
若您未指定,则系统自动使用 API 请求的 RequestId 作为 ClientToken 标识。每次 API 请求的 RequestId 可能不一样。 |
02fb3da4-130e-11e9-8e44-001**** |
ResourceGroupId |
string |
否 |
资源组 ID。 关于资源组的更多信息,请参见什么是资源组。 |
rg-acfmxazb4ph6aiy**** |
Bandwidth |
integer |
否 |
需要创建的 VPC 对等连接的带宽值,单位:Mbps,取值范围为大于 0 的整数。 说明
如需指定该参数,请确保您创建的是跨地域的对等连接。 |
100 |
LinkType |
string |
否 |
链路类型。 可选值为 Platinum(铂金),Gold(金),默认为 Gold(金)。 说明
如需指定该参数,请确保您创建的是跨地域的对等连接。 |
Gold |
Tag |
array<object> |
否 |
标签信息。 |
|
object |
否 |
标签信息。 |
||
Key |
string |
否 |
资源的标签键。至少输入 1 个标签键,最多支持输入 20 个标签键。一旦传入该值,则不允许为空字符串。 最多支持 128 个字符,不能以 |
FinanceDept |
Value |
string |
否 |
资源的标签值。至少输入 1 个标签值,最多支持输入 20 个标签值。一旦传入该值,可以为空字符串。 最多支持 128 个字符,不能以 |
FinanceJoshua |
返回参数
名称 |
类型 |
描述 |
示例值 |
object |
请求 ID。 |
||
RequestId |
string |
请求 ID。 |
54B48E3D-DF70-471B-AA93-08E683A1B45 |
InstanceId |
string |
创建的 VPC 对等连接的实例 ID。 |
pcc-lnk0m24khwvtkm**** |
示例
正常返回示例
JSON
格式
{
"RequestId": "54B48E3D-DF70-471B-AA93-08E683A1B45",
"InstanceId": "pcc-lnk0m24khwvtkm****"
}
错误码
HTTP status code |
错误码 |
错误信息 |
描述 |
---|---|---|---|
400 | OperationFailed.CdtNotOpened | The operation failed because the Cdt service is not opened. | 创建操作失败,因为未开通Cdt服务 |
400 | OperationFailed.CrossBorderCdtNotOpened | The operation failed because the CrossBorderCdt service is not opened. | 操作失败,因为未打开CrossBorderCdt服务。 |
400 | IncorrectStatus.Vpc | The status of %s [%s] is incorrect. | 发起端VPC实例状态不正确。 |
400 | IncorrectStatus.AcceptingVpc | The status of %s [%s] is incorrect. | 接收端VPC状态不正确。 |
400 | ResourceAlreadyExist.RouterInterface | The specified resource of %s already exists. | 指定的路由器接口已经存在 |
400 | ResourceAlreadyExist.VpcPeer | The specified resource of %s already exists. | 指定的VpcPeer已经存在 |
400 | OperationDenied.CloudBoxExistsInVpc | The operation is not allowed because the CloudBox device exists in vpc. | 在发起端VPC内存在云盒实例,因此不允许创建VpcPeer实例。 |
400 | OperationDenied.CloudBoxExistsInAcceptingVpc | The operation is not allowed because the CloudBox device exists in accepting vpc. | 在接收端VPC内存在云盒实例,因此不允许创建VpcPeer实例。 |
400 | QuotaExceeded.VpcPeerCountPerVpc | The quota of %s is exceeded, usage %s/%s. | 指定VPC中的VpcPeer数量超出限制 |
400 | UnsupportedRegion | The feature of %s is not supported in the region of %s. | VpcPeer特性在此地域不支持 |
400 | QuotaExceeded.VpcPeerCountPerUserPerRegion | The quota of %s is exceeded, usage %s/%s. | 单个地域内VpcPeer实例数量超过阈值。 |
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. | 资源组不存在,操作失败。 |
400 | OperationFailed.AcceptUserCdtNotOpened | The operation failed because the Cdt service of accept user is not opened. | 对端Cdt服务未开通,操作失败。 |
400 | OperationFailed.AcceptUserCrossBorderCdtNotOpened | The operation failed because the CrossBorderCdt service of accept user is not opened. | 对端跨境Cdt服务未开通,操作失败。 |
400 | IncorrectBusinessStatus.AcceptUserVpcPeer | The business status of %s [%s] is incorrect. | 对端VpcPeer商业状态异常。 |
400 | OperationFailed.ViolativeVpcPeer | The creation operation fails because it is not allowed to create a vpc peer instance between the originating region and the receiving region. | 创建操作失败是因为不允许创建发起地域与接受地域之间的vpc peer实例。 |
400 | QuotaExceeded.CrossRegionVpcPeerCountPerVpc | The quota of %s is exceeded, usage %s/%s. | 指定VPC中的跨地域VpcPeer数量超出限制 |
400 | QuotaExceeded.IntraRegionVpcPeerCountPerVpc | The quota of %s is exceeded, usage %s/%s. | 指定VPC中的同地域VpcPeer数量超出限制 |
400 | OperationDenied.OperateShareResource | The operation is not allowed because of operating shared resource. | 操作共享资源导致操作失败 |
400 | IncorrectBusinessStatus.AcceptVpcPeer | The business status of peer account is incorrect. | 对端VpcPeer商业状态异常。 |
400 | OperationFailed.InterRegionLinkTypeNotSupported | The same region not supported link type feature. | 同地域不支持链路类型特性 |
400 | OperationFailed.RegionIdNotSupportLinkType | The feature link type is not supported in the region. | 地域不支持该特性金银铜设置 |
400 | OperationFailed.SpecificLinkTypeNotSupported | The operation failed because the special link type of user is not opened. | 该账号不支持特殊链路类型 |
400 | OperationFailed.CrossBusinessNotAllowed | Operation failed because receiver and accepter belong to different business site. |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。