全部產品
Search
文件中心

Cloud Enterprise Network:CreateTransitRouterVpcAttachment

更新時間:Sep 15, 2026

呼叫CreateTransitRouterVpcAttachment介面將要互通的專有網路VPC(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程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

cen:CreateTransitRouterVpcAttachment

create

CenInstance

acs:cen:*:{#accountId}:ceninstance/{#ceninstanceId}

TransitRouter

acs:cen:*:{#accountId}:centransitrouter/{#TransitRouterId}

無 無

請求參數

名稱

類型

必填

描述

樣本值

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(預設值):發送正常請求,通過檢查後直接建立 VPC 連線。

  • true:發送檢查請求,只進行校驗,不會建立 VPC 連線。檢查項目包括是否填寫了必需參數、請求格式等。如果檢查不通過,則返回對應錯誤。如果檢查通過,則返回錯誤碼DryRunOperation。

false

ZoneMappings

array<object>

是

請在企業版轉發路由器的可用區中選擇一個交換器執行個體。

一次最多支援新增 10 組資訊。

object

否

企業版轉發路由器支援的可用區及其對應的交換器執行個體的資訊。

VSwitchId

string

是

在企業版轉發路由器支援的可用區中選擇一個交換器執行個體。

一次最多支援為 10 個可用區選擇交換器執行個體。

vsw-bp1a214sbus8z3b54****

ZoneId

string

是

企業版轉發路由器支援的可用區的 ID。

您可以透過 DescribeZones 介面查詢可用區的 ID。

一次最多支援選擇 10 個可用區。

cn-hangzhou-h

AutoPublishRouteEnabled

boolean

否

是否使企業版轉發路由器自動發布路由到 VPC 執行個體。

  • false(預設值):否。

  • true:是。

true

TransitRouterVPCAttachmentOptions

object

否

VPC 連線的功能屬性清單(即將廢棄,請使用新入參 Options)。

string

否

VPC 連線的功能屬性(即將廢棄,請使用新入參 Options)。

ipv6Support:是否開啟 IPv6 功能。

  • enable:開啟 IPv6 功能。

  • disable:關閉 IPv6 功能。

說明

為 VPC 連線開啟 IPv6 功能前,請確保 VPC 執行個體及其關聯的交換器執行個體已經開啟 IPv6 功能。具體操作,請參見 AllocateVpcIpv6Cidr 和 CreateVSwitchCidrReservation 。

disable

Tag

array<object>

否

標籤清單。

一次最多支援輸入 20 個標籤資訊。

object

否

標籤。

Key

string

否

資源的標籤鍵。

一旦傳入該值,則不允許為空字串。最多支援 64 個字元,不能以aliyun或者acs:開頭,不能包含http://或者https:// 。

一次最多支援輸入 20 個標籤的標籤鍵。

tagtest

Value

string

否

資源的標籤值。

一旦傳入該值,則不允許為空。支援輸入不超過 128 個字元的字串,不能以 aliyun 或者 acs:開頭,不能包含 http://或者 https:// 。

每一個標籤鍵對應一個標籤值,一次最多支援輸入 20 個標籤鍵對應的標籤值。

tagtest

Options

object

否

功能屬性集合。

ApplianceModeSupport

string

否

是否開啟網元導流模式。

  • disable(預設值):否。

  • enable:是。

enable

Ipv6Support

string

否

是否支援 IPv6。

  • disable(預設值):否。

  • enable:是。

enable

返回參數

名稱

類型

描述

樣本值

object

傳回結果。

RequestId

string

請求 ID。

C087A369-82B9-43EF-91F4-4B63A9C6E6B6

TransitRouterAttachmentId

string

VPC 連線 ID。

tr-attach-ia340z7xis7t5s****

樣本

正常返回樣本

JSON格式

{
  "RequestId": "C087A369-82B9-43EF-91F4-4B63A9C6E6B6",
  "TransitRouterAttachmentId": "tr-attach-ia340z7xis7t5s****"
}

錯誤碼

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. 每個轉送路由器支援連線的專有網路VPC個數超限。
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. 使用者指定的ResourceType不合法。
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. 只有專有網路連線支援網元導流模式。
400 InvalidParameter.TagValue The specified parameter TagValue is invalid. 輸入的參數Tag Value不合法。
400 InvalidParameter.CenBandwidthPackageId The specified parameter CenBandwidthPackageId is invalid. 輸入的參數CenBandwidthPackageId不合法。
400 InvalidParameter.CenId The specified parameter CenId is invalid. 輸入的參數CenId不合法。
400 InvalidParameter.TransitRouterId The specified parameter TransitRouterId is invalid. 輸入的參數TransitRouterId不合法。
400 InvalidParameter.AssociateRouteTableId The specified parameter AssociateRouteTableId is invalid. 輸入的參數AssociateRouteTableId不合法。
400 OperationFailed.PostPay95BwpNotAllowEnterpriseTr Cbn with post pay 95 bandwidth package does not allow enterprise tr. 使用舊版95頻寬包的雲端企業網不允許建立企業版轉送路由器。
400 OperationUnsupported.VpcRoutePropagationSource The operation on this VPC route propagation source is not supported. 不支援對此VPC路由傳播來源的操作。
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.

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情。