呼叫 CreateVpcPeerConnection 介面建立 VPC 對等連線。
介面說明
建立 VPC 對等連線前,您需要完成以下事項:
- CreateVpcPeerConnection 介面屬於非同步介面,即系統會先返回一個 InstanceId,但該 VPC 對等連線執行個體並未建立完成,系統後台的建立任務仍在進行。您可以呼叫 GetVpcPeerConnectionAttribute 查詢 VPC 對等連線的狀態。
當 VPC 對等連線處於 Creating 狀態時,表示 VPC 對等連線正在建立中。
當 VPC 對等連線處於 Activated 狀態時,表示 VPC 對等連線建立完成。
當 VPC 對等連線處於 Accepting 狀態時,為跨帳號場景,跨帳號場景需要在接收端接收。
CreateVpcPeerConnection 介面不支援在同一個 VPC 下並發建立 VPC 對等連線。
建立 VPC 對等連線時,系統會為您自動啟用非跨境雲端資料傳輸 CDT(Cloud DataTransfer)功能。
調試
您可以在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。 |
||
| InstanceId |
string |
建立的 VPC 對等連線的執行個體 ID。 |
pcc-lnk0m24khwvtkm**** |
| RequestId |
string |
請求 ID。 |
54B48E3D-DF70-471B-AA93-08E683A1B45 |
樣本
正常返回樣本
JSON格式
{
"InstanceId": "pcc-lnk0m24khwvtkm****",
"RequestId": "54B48E3D-DF70-471B-AA93-08E683A1B45"
}
錯誤碼
|
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. | 未開啟阿里雲跨境資料傳輸功能。 |
| 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. | 發起方與接收方屬於不同站點,不允許建立VpcPeer。 |
| 400 | OperationFailed.ChargeTypeNotSupported | Operation failed because the CDT charge type of receiver or accepter does not support the Underlay link type. | 操作失敗,因為發起端或者接收端的CDT計費類型不支援Underlay鏈路類型。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。