調用CreateTransitRouterVpcAttachment介面將要互連的Virtual Private Cloud(Virtual Private Cloud)執行個體串連至轉寄路由器執行個體。串連後,轉寄路由器執行個體可以協助您實現私網互連。
介面說明
-
您可以通過以下兩種方式在企業版轉寄路由器下建立 VPC 串連:
如果您已經在目標地區建立了企業版轉寄路由器執行個體,您可以通過指定 VpcId、ZoneMappings.N.VSwitchId、ZoneMappings.N.ZoneId和 TransitRouterId、RegionId 建立 VPC 串連。
如果您在目標地區沒有企業版轉寄路由器執行個體,您可以通過指定 VpcId、ZoneMappings.N.VSwitchId、ZoneMappings.N.ZoneId、CenId 和 RegionId 建立 VPC 串連。建立 VPC 串連時系統為您自動建立企業版轉寄路由器執行個體。
-
CreateTransitRouterVpcAttachment 介面屬於非同步介面,即系統會先返回一個 VPC 串連 ID,但該 VPC 串連並未建立完成,系統背景建立任務仍在進行。您可以調用 ListTransitRouterVpcAttachments 介面查詢 VPC 串連的狀態。
當 VPC 串連處於 Attaching 狀態時,表示 VPC 串連正在建立中,在該狀態下,您只能對 VPC 串連執行查詢操作,不能執行其他動作。
當 VPC 串連處於 Attached 狀態時,表示 VPC 串連建立完成。
-
建立 VPC 串連後,VPC 串連預設不與任何轉寄路由器路由表建立路由學習關係和關聯轉寄關係。
前提條件
在調用本介面建立 VPC 串連前,請確保滿足以下條件:
VPC 執行個體在企業版轉寄路由器支援的可用性區域擁有至少一個交換器執行個體,且該交換器執行個體擁有至少一個閒置 IP 位址。關於企業版轉寄路由器支援的地區和可用性區域資訊,請參見企業版轉寄路由器支援的地區和可用性區域。
如果您要串連跨帳號的網路執行個體,請先獲得跨帳號網路執行個體授權。具體操作,請參見跨帳號網路執行個體授權。
VPC 串連建立後會產生費用,請確保您已經瞭解相關計費規則。更多資訊,請參見計費說明。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
cen:CreateTransitRouterVpcAttachment |
create |
CenInstance
TransitRouter
|
無 | 無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| ClientToken |
string |
否 |
用戶端 Token,用於保證請求的等冪性。 從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。ClientToken 只支援 ASCII 字元。 說明
若您未指定,則系統自動使用 API 請求的 RequestId 作為 ClientToken 標識。每次 API 請求的 RequestId 不一樣。 |
02fb3da4-130e-11e9-8e44-001**** |
| CenId |
string |
否 |
雲企業網執行個體 ID。 |
cen-j3jzhw1zpau2km**** |
| TransitRouterId |
string |
否 |
企業版轉寄路由器執行個體 ID。 |
tr-bp1su1ytdxtataupl**** |
| RegionId |
string |
否 |
VPC 執行個體所屬地區 ID。 您可以通過調用 DescribeChildInstanceRegions 介面擷取地區 ID。 |
cn-hangzhou |
| TransitRouterAttachmentName |
string |
否 |
VPC 串連的名稱。 名稱可以為空白或長度為 1~128 個字元,不能以 http://或 https://開頭。 |
testname |
| TransitRouterAttachmentDescription |
string |
否 |
VPC 串連的描述資訊。 描述可以為空白或長度為 1~256 個字元,不能以 http://或 https://開頭。 |
testname |
| VpcId |
string |
是 |
VPC 執行個體 ID。 |
vpc-bp1kbjcre9vtsebo1**** |
| VpcOwnerId |
integer |
否 |
VPC 執行個體所屬阿里雲帳號(主帳號)ID。預設值為當前登入的阿里雲帳號 ID。 說明
如果您要載入跨帳號的網路執行個體,本參數必填。 |
1250123456123456 |
| ChargeType |
string |
否 |
付費方式。預設值:POSTPAY,表示隨用隨付。 |
POSTPAY |
| DryRun |
boolean |
否 |
是否對此次請求執行預檢,包括許可權、執行個體狀態校正等。取值:
|
false |
| ZoneMappings |
array<object> |
是 |
請在企業版轉寄路由器的可用性區域中選擇一個交換器執行個體。 一次最多支援添加 10 組資訊。 |
|
|
object |
否 |
企業版轉寄路由器支援的可用性區域及其對應的交換器執行個體的資訊。 |
||
| VSwitchId |
string |
是 |
在企業版轉寄路由器支援的可用性區域中選擇一個交換器執行個體。 一次最多支援為 10 個可用性區域選擇交換器執行個體。 |
vsw-bp1a214sbus8z3b54**** |
| ZoneId |
string |
是 |
企業版轉寄路由器支援的可用性區域的 ID。 您可以通過 DescribeZones 介面查詢可用性區域的 ID。 一次最多支援選擇 10 個可用性區域。 |
cn-hangzhou-h |
| AutoPublishRouteEnabled |
boolean |
否 |
是否使企業版轉寄路由器自動發布路由到 VPC 執行個體。
|
true |
| TransitRouterVPCAttachmentOptions |
object |
否 |
VPC 串連的功能屬性列表。 |
|
|
string |
否 |
VPC 串連的功能屬性。 ipv6Support:是否開啟 IPv6 功能。
說明
為 VPC 串連開啟 IPv6 功能前,請確保 VPC 執行個體及其關聯的交換器執行個體已經開啟 IPv6 功能。具體操作,請參見 AllocateVpcIpv6Cidr 和 CreateVSwitchCidrReservation 。 |
disable |
|
| Tag |
array<object> |
否 |
標籤列表。 一次最多支援輸入 20 個標籤資訊。 |
|
|
object |
否 |
標籤。 |
||
| Key |
string |
否 |
資源的標籤鍵。 一旦傳入該值,則不允許為空白字串。最多支援 64 個字元,不能以 一次最多支援輸入 20 個標籤的標籤鍵。 |
tagtest |
| Value |
string |
否 |
資源的標籤值。 標籤值可以為空白或輸入不超過 128 個字元的字串,不能以 每一個標籤鍵對應一個標籤值,一次最多支援輸入 20 個標籤鍵對應的標籤值。 |
tagtest |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
返回結果。 |
||
| TransitRouterAttachmentId |
string |
VPC 串連 ID。 |
tr-attach-ia340z7xis7t5s**** |
| RequestId |
string |
請求 ID。 |
C087A369-82B9-43EF-91F4-4B63A9C6E6B6 |
樣本
正常返回樣本
JSON格式
{
"TransitRouterAttachmentId": "tr-attach-ia340z7xis7t5s****",
"RequestId": "C087A369-82B9-43EF-91F4-4B63A9C6E6B6"
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | OperationUnsupported.TransitRouterRegionId | The specified TransitRouterRegion does not support the operation. | |
| 400 | NoPermission.AliyunServiceRoleForCEN | You are not authorized to create the service linked role. Role Name: AliyunServiceRoleForCEN. Service Name: cen.aliyuncs.com. Make sure that the user has been granted the ram:CreateServiceLinkedRole permission. | 您沒有許可權建立服務關聯角色,角色名稱:AliyunServiceRoleForCEN,服務名:cen.aliyuncs.com。請確保已授予目前使用者ram:CreateServiceLinkedRole許可權。 |
| 400 | IllegalParam.RegionId | The Specified Parameter RegionId is illegal | 參數中指定的Region不合法。 |
| 400 | MissingParam.CenIdOrRegionId | Either CenId or RegionId must be specified. | CenId或者RegionId是必選參數。 |
| 400 | IllegalParam.ZoneId | The specified ZoneId is illegal. | 傳入的可用性區域非法 |
| 400 | IllegalParam.ChargeType | The specified ChargeType is illegal. | 付費類型非法 |
| 400 | InvalidTransitRouterId.NotFound | The specified TransitRouterId is not found. | 指定的轉寄路由器不存在 |
| 400 | IncorrectStatus.VpcResource | The resource is not in a valid state for the attachment operation. | 當前VPC資源不處於穩態,無法進行該操作,請等待與當前VPC相關操作結束後重試。 |
| 400 | IncorrectStatus.Vpc | The resource is not in a valid state for the attachment operation. | 當前VPC的狀態不支援該操作,請稍後重試。 |
| 400 | IncorrectStatus.VpcOrVswitch | The Vpc Or Vswith is not in a valid state for the attachment operation. | 當前vpc或vswitch的狀態不支援該操作,請稍後重試。 |
| 400 | OperationNotSupport.VpcAutoRoutesPublish | Auto publish vpc routes is not supported in this region. | 當前地區暫不支援vpc路由自動發布。 |
| 400 | InvalidOperation.VpnAssociated | The operation is not supported because the VPC is associated with VPN. | 當前VPC與VPN綁定,無法開啟路由自動同步功能。 |
| 400 | Forbbiden.TransitRouterServiceNotOpen | The user has not open transit router service. | 轉寄路由器服務未開啟,請開啟後重試。 |
| 400 | IllegalParam.ZoneMappings | The Specified Parameter ZoneMappings is illegal | 參數中指定的ZoneMappings不合法。 |
| 400 | OperationUnsupported.TransitRouterType | The specified TransitRouterType does not support the operation. | 當前TransitRouter類型不支援該操作。 |
| 400 | InvalidCenId.NotFound | CenId is not found. | CEN執行個體不存在。 |
| 400 | IllegalParam.VSwitchId | VSwitchId is illegal. | 參數中指定的VSwitchId不合法。 |
| 400 | IncorrectStatus.TransitRouterInstance | The status of TransitRouter is incorrect. | 轉寄路由器狀態不正確。 |
| 400 | OperationUnsupported.CenFullLevel | CEN full level does not support TransitRouter | Full類型CEN不支援建立企業版轉寄路由器。 |
| 400 | IllegalParam.ServiceMode | ServiceMode is illegal. | ServiceMode不合法。 |
| 400 | QuotaFull.ChildInstanceRelatedCen | The childinstance has exceed the quota of the times that a childinstance can be attached as an attachment. | 該執行個體綁定CEN數量已達到上限,無法載入。 |
| 400 | OperationUnsupported.CloudBoxVswNotSupport | Cloud Box vsw does not support. | 雲盒的vsw不允許載入。 |
| 400 | IncorrectStatus.TransitRouter | The status of TransitRouter is incorrect. | 當前TransitRouter的狀態不支援該操作,請稍後重試。 |
| 400 | Duplicated.ZoneMapping | The parameter ZoneMapping is duplicated. | ZoneMapping中存在重複的條目。 |
| 400 | QuotaExceeded.CenQuotaVpcAttachPerTransitRouter | The maximum number of VPC attachment per Transit Router is exceeded. | 每個轉寄路由器支援串連的Virtual Private Cloud個數超限。 |
| 400 | IncorrectStatus.VpcRouteTable | The VPC route table is not in a desired state. | 該操作相關的VPC路由表不處於穩態,無法操作,請稍後重試。 |
| 400 | InvalidStatus.VpcAttachedFullModeCen | The VPC has been attached to another CEN instance whose protection level is FULL. | 參數中指定的vpc載入到另一個protection level為FULL的cen中,無法再載入到其他cen中。 |
| 400 | Forbbiden.AttachChildInstanceAcrossBid | VPCs that belong to another BID cannot be associated. You need to apply for cross-BID attaching. | 不允許綁定不同bid帳號下的VPC。 |
| 400 | InvalidOperation.VpcAutoRoutesPublishInOtherCEN | The specified VPC already has its routes synchronized with another CEN instance. | 當前VPC已經在其他CEN中開啟了路由自動同步,無法支援該操作。 |
| 400 | QuotaExceeded.VpcAutoRoutesPublishPerTransitRouter | The number of VPCs that have route synchronization enabled has reached the upper limit. | 開啟路由自動同步的VPC數量已達到上限。 |
| 400 | InsufficientIpAddr.vsw | Insufficient available IP addresses in the vSwitch. | 虛擬交換器中的可用IP數目不足 |
| 400 | Forbidden.ResourceOwnerTransitRouterServiceNotOpen | The resource owner user has not opened transit router service. | 資源所屬帳號轉寄路由器服務未開通,請通知對方開通後重試。 |
| 400 | IllegalParam.TransitRouterRegionId | TransitRouterRegionId is illegal. | TransitRouterRegionId不合法。 |
| 400 | InvalidTransitRouterMode.NeedUpgrade | TransitRouter need to upgrade. | 當前轉寄路由器模式不支援。 |
| 400 | IllegalParam.Ipv6Support | Ipv6Support is illegal. Valid Values are [enable, disable]. | 請求參數Ipv6Support值非法,有效值為enable或disable。 |
| 400 | OperationFailed.VSwitchNotFound | The specified vswitch not found. | 指定的VSwitchId不存在,請確認該VSwitch狀態是否可用或指定其他可用的VSwitch。 |
| 400 | OperationFailed.VSwitchIpv6CidrNotAllocated | The specified vswitch does not have IPv6 address allocated. | 指定的VSwitch未開通Ipv6,請開通Ipv6後再進行該操作。 |
| 400 | Forbidden.ResourceOwnerTransitRouterServiceExpired | The transit router service of the account to which the resource belongs has been suspended due to arrears. Please notify the other party to renew the service and try again. | 資源所屬帳號的轉寄路由器服務已欠費停服,請通知對方續約後重試。 |
| 400 | Forbidden.TransitRouterServiceExpired | The transit router service is out of service. | 轉寄路由器服務已欠費停服,請續約後重試。 |
| 400 | InvalidParameter | Invalid parameter. | 參數不合法。 |
| 400 | Unauthorized | The AccessKeyId is unauthorized. | 帳號無許可權操作。 |
| 400 | InvalidParameter.ResourceType | The specified parameter ResourceType is invalid. | |
| 400 | ParamExclusive.TransitRouterVPCAttachmentOptionsAndOptions | When creating or modifying a VPC attachment, the input parameter TransitRouterVPCAttachmentOptions and Options cannot be used at the same time. | 建立或修改專用網路串連時,不支援同時使用入參TransitRouterVPCAttachmentOptions和Options。 |
| 400 | InvalidParameter.ApplianceModeSupport | The specified parameter ApplianceModeSupport is invalid. | 輸入的參數ApplianceModeSupport不合法。 |
| 400 | InvalidParameter.Ipv6Support | The specified parameter Ipv6Support is invalid. | 輸入的參數Ipv6Support不合法。 |
| 400 | INVALID_OPERATION_RESOURCE_NOT_SUPPORT_APPLIANCE_MODE | Only VPC attachment support appliance mode. | 只有專用網路串連支援網元導流模式。 |
| 404 | InvalidVSwitchId.NotFound | The specified VSwitchId is not found. | 指定的VSwitchId不存在。 |
| 409 | InvalidOperation.CenInstanceStatus | The CEN instance is not in a valid state for the operation. | cen目前狀態不支援該操作,請稍後重試。 |
| 409 | IncorrectStatus.VpcSwitch | The resource is not in a valid state for the attachment operation. |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。