全部产品
Search
文档中心

云企业网:CreateTransitRouterEcrAttachment - 在企业版转发路由器下创建专线网关ECR连接

更新时间:Jul 14, 2025

您可以调用CreateTransitRouterEcrAttachment接口将要互通的专线网关ECR(ExpressConnect Router)网络实例连接到同地域的转发路由器实例中。

接口说明

  • 仅企业版转发路由器支持创建 ECR 连接。

  • 您可以通过以下两种方式在企业版转发路由器下创建 ECR 连接:

    • 如果您已经在目标地域创建了企业版转发路由器实例,您可以通过指定 EcrIdRegionIdTransitRouterId 创建 ECR 连接。

    • 如果您在目标地域没有企业版转发路由器实例,您可以通过指定 EcrIdCenIdRegionId 创建 ECR 连接。创建 ECR 连接时系统为您自动创建企业版转发路由器实例。

  • CreateTransitRouterEcrAttachment 接口属于异步接口,即系统会先返回一个 ECR 连接 ID,但该 ECR 连接并未创建完成,系统后台的创建任务仍在进行。您可以调用 ListTransitRouterEcrAttachments 接口查询 ECR 连接的状态。

    • 当 ECR 连接处于 Attaching 状态时,表示 ECR 连接正在创建中,在该状态下,您只能对 ECR 连接执行查询操作,不能执行其他操作。

    • 当 ECR 连接处于 Attached 状态时,表示 ECR 连接创建完成。

  • 创建 ECR 连接后,ECR 连接默认不与任何企业版转发路由器路由表建立路由学习关系和关联转发关系。

    当 ECR 连接与企业版转发路由器路由表建立路由学习关系后,系统会自动将 ECR 实例的路由传播至企业版转发路由器路由表中。

  • 创建 ECR 连接后,系统自动将 ECR 连接关联的企业版转发路由器路由表中的路由传播到 ECR 实例的路由表中。

前提条件

  • 企业版转发路由器所属的阿里云账号和 ECR 实例所属的阿里云账号属于同一家企业。

  • 企业版转发路由器支持连接同账号和跨账号的 ECR 实例。在创建跨账号的 ECR 连接前,请先获得跨账号 ECR 实例的授权。具体操作,请参见跨账号网络实例授权

  • 调用本接口创建 ECR 连接前,请先调用 CreateExpressConnectRouterAssociation 接口为 ECR 实例和企业版转发路由器实例创建关联关系。

    当您调用 DeleteTransitRouterEcrAttachment 接口强制删除 ECR 连接时,系统将会一并删除 ECR 实例和企业版转发路由器实例间的关联关系,无需再额外删除。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

cen:CreateTransitRouterEcrAttachment

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-7qthudw0ll6jmc****

TransitRouterId

string

转发路由器实例 ID。

tr-bp1su1ytdxtataupl****

RegionId

string

转发路由器实例所属的地域 ID。

您可以通过调用 DescribeChildInstanceRegions 接口获取地域 ID。

eu-central-1

TransitRouterAttachmentName

string

ECR 连接的名称。

名称可以为空或长度为 1~128 个字符,不能以 http://或 https://开头。

nametest

TransitRouterAttachmentDescription

string

ECR 连接描述。

描述可以为空或长度为 1~256 个字符,不能以 http://或 https://开头。

testdesc

EcrId

string

关联的专线网关实例 ID。

ecr-upyc0viial107r****

EcrOwnerId

integer

ECR 实例所属阿里云账号(主账号)ID。默认值为当前登录的阿里云账号 ID。

说明

如果您要加载跨账号的网络实例,本参数必填。

1250123456123456

DryRun

boolean

是否只预检此次请求。取值:

  • true:发送检查请求,不会修改 VPN 连接的配置。检查项包括是否填写了必需参数、请求格式、业务限制。如果检查不通过,则返回对应错误。如果检查通过,则返回错误码DryRunOperation

  • false(默认值):发送正常请求,通过检查后直接修改 VPN 连接的配置。

false

Tag

array

标签信息列表。

一次最多支持输入 20 个标签信息。

object

Key

string

资源的标签键。

一旦传入该值,则不允许为空字符串。最多支持 64 个字符,不能以aliyun或者acs:开头,不能包含http://或者https://

一次最多支持输入 20 个标签的标签键。

tagtest

Value

string

资源的标签值。

标签值可以为空或输入不超过 128 个字符的字符串,不能以aliyun或者acs:开头,不能包含http://或者https://

每一个标签键对应一个标签值,一次最多支持输入 20 个标签键对应的标签值。

tagtest

返回参数

名称

类型

描述

示例值

object

TransitRouterAttachmentId

string

ECR 连接 ID。

tr-attach-qieks13jnt1cchy***

RequestId

string

请求 ID。

C0245BEF-52AC-44A8-A776-EF96FD26A5CA

示例

正常返回示例

JSON格式

{
  "TransitRouterAttachmentId": "tr-attach-qieks13jnt1cchy***",
  "RequestId": "C0245BEF-52AC-44A8-A776-EF96FD26A5CA"
}

错误码

HTTP status code

错误码

错误信息

描述

400 NoPermission.AliyunServiceRolePolicyForCEN You are not authorized to create the service linked role. Role Name: AliyunServiceRolePolicyForCEN. Service Name: cen.aliyuncs.com. Make sure that the user has been granted the ram:CreateServiceLinkedRole permission. 您没有权限创建服务关联角色,角色名:AliyunServiceRolePolicyForCEN,服务名:cen.aliyuncs.com。请确保已授予当前用户ram:CreateServiceLinkedRole权限。
400 OperationUnsupported.TransitRouterRegionId The specified TransitRouterRegion does not support the operation.
400 InvalidCenId.NotFound CenId is not found. CEN实例不存在。
400 InvalidStatus.ResourceStatus The resource is not in a valid state for the attachment operation. 当前资源状态不支持该操作,请稍后重试。
400 InvalidTransitRouterId.NotFound TransitRouterId is not found. 转发路由实例ID不存在。
400 Forbbiden.TransitRouterServiceNotOpen The user has not open transit router service. 转发路由器服务未打开,请打开后重试。
400 OperationUnsupported.TransitRouterType The specified TransitRouterType does not support the operation. 当前TransitRouter类型不支持该操作。
400 MissingParam.CenIdOrRegionId Either CenId or RegionId must be specified. CenId或者RegionId是必选参数。
400 IllegalParam.AssociateRouteTableId The specified AssociateRouteTableId is illegal. 参数中指定的AssociateRouteTableId不合法。
400 Forbbiden.AttachChildInstanceAcrossBid Operation is invalid, please apply for cross-bid attaching.
400 IllegalParam.RegionId RegionId is illegal. 参数中指定的Region不合法。
400 OperationUnsupported.CenFullLevel CEN full level does not support TransitRouter Full类型CEN不支持创建企业版转发路由器。
400 InvalidOperation.CenInstanceStatus The CEN instance is not in a valid state for the operation.
400 IncorrectStatus.TransitRouter The status of TransitRouter is incorrect. 当前TransitRouter的状态不支持该操作,请稍后重试。
400 QuotaFull.ChildInstanceRelatedCen The childinstance has exceed the quota of the times that a childinstance can be attached as an attachment. 该实例绑定CEN数量已达到上限,无法加载。
400 Forbidden.ResourceOwnerTransitRouterServiceNotOpen The resource owner user has not opened transit router service. 资源所属账号转发路由器服务未开通,请通知对方开通后重试。
400 OperationUnsupported.BandwidthType The specified BandwidthType does not support the operation. 当前BandwidthType不支持该操作。
400 IllegalParam.BandwidthType BandwidthType is illegal. 带宽包类型不合法。
400 IncorrectStatus.EcrResource The ECR resource is not in a valid state for the attachment operation. ECR资源状态非法。
400 QuotaExceeded.CenQuotaEcrAttachPerTransitRouter The maximum number of ECR attachment per Transit Router is exceeded. 转发路由器下的ECR连接数量超限。
400 OperationUnsupported.ECRAttachment ECR Attachment is not supported. 不支持ECR Attachment。
400 InvalidTransitRouterMode.NeedUpgrade TransitRouter need to upgrade. 当前转发路由器模式不支持。
400 ResourceNotFound The resource does not found. 资源不存在。
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 Forbbiden.AttachAcrossBidEcr Attach cross bid ECR is unsupported. Please submit a ticket. 不允许绑定不同Bid账号下的ECR,请提交工单申请。
400 InvalidParameter Invalid parameter. 参数不合法。
400 Unauthorized The AccessKeyId is unauthorized. 账号无权限操作。
400 InvalidParameter.ResourceType The specified parameter ResourceType is invalid.

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情