All Products
Search
Document Center

Cloud Enterprise Network:CreateTransitRouterVpcAttachment

Last Updated:Mar 01, 2024

Attaches a virtual private cloud (VPC) to an Enterprise Edition transit router.

Operation description

  • You can use the following methods to attach a VPC to an Enterprise Edition transit router:

    • If an Enterprise Edition transit router is already created in the region where you want to create a VPC connection, set VpcId, ZoneMappings.N.VSwitchId, ZoneMappings.N.ZoneId, and TransitRouterId.
    • If no Enterprise Edition transit router is created in the region where you want to create a VPC connection, set VpcId, ZoneMappings.N.VSwitchId, ZoneMappings.N.ZoneId, CenId, and RegionId. When you create a VPC connection, the system automatically creates an Enterprise Edition transit router in the specified region.
  • CreateTransitRouterVpcAttachment is an asynchronous operation. After you send a request, the VPC connection ID is returned but the operation is still being performed in the system background. You can call the ListTransitRouterVpcAttachments operation to query the status of a VPC connection.

    • If a VPC connection is in the Attaching state, the VPC connection is being created. You can query the VPC connection but cannot perform other operations.
    • If a VPC connection is in the Attached state, the VPC connection is created.
  • By default, route learning and associated forwarding are disabled between transit router route tables and VPC connections.

Prerequisites

Before you call this operation, make sure that the following requirements are met:

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
cen:CreateTransitRouterVpcAttachmentWrite
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ClientTokenstringNo

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters.

Note If you do not set this parameter, ClientToken is set to the value of RequestId. The value of RequestId for each API request may be different.
02fb3da4-130e-11e9-8e44-001****
CenIdstringNo

The ID of the Cloud Enterprise Network (CEN) instance.

cen-j3jzhw1zpau2km****
TransitRouterIdstringNo

The ID of the Enterprise Edition transit router.

tr-bp1su1ytdxtataupl****
RegionIdstringNo

The ID of the region where the VPC is deployed.

You can call the DescribeChildInstanceRegions operation to query the most recent region list.

cn-hangzhou
TransitRouterAttachmentNamestringNo

The name of the VPC connection.

The name must be 1 to 128 characters in length, and cannot start with http:// or https://. You can also leave this parameter empty.

testname
TransitRouterAttachmentDescriptionstringNo

The description of the VPC connection.

The description must be 1 to 256 characters in length, and cannot start with http:// or https://. You can also leave this parameter empty.

testname
VpcIdstringYes

The VPC ID.

vpc-bp1kbjcre9vtsebo1****
VpcOwnerIdlongNo

The ID of the Alibaba Cloud account to which the VPC belongs. The default value is the ID of the current Alibaba Cloud account.

Note If the network instance and CEN instance belong to different Alibaba Cloud accounts, this parameter is required.
1250123456123456
ChargeTypestringNo

The billing method. The default value is POSTPAY, which specifies the pay-as-you-go billing method.

POSTPAY
DryRunbooleanNo

Specifies whether to perform a dry run. Valid values:

  • false (default): performs a dry run and sends the request.
  • true: performs a dry run. The system checks the required parameters and request syntax. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned.
false
ZoneMappingsobject []Yes

A zone that supports Enterprise Edition transit routers.

You can specify at most 10 zones.

VSwitchIdstringYes

A vSwitch that is deployed in the zone that supports Enterprise Edition transit routers.

You can specify vSwitches for at most 10 zones in each call.

vsw-bp1a214sbus8z3b54****
ZoneIdstringYes

The ID of the zone that supports Enterprise Edition transit routers.

You can call the DescribeZones operation to query the most recent zone list.

You can specify at most 10 zones in each call.

cn-hangzhou-h
AutoPublishRouteEnabledbooleanNo

Specifies whether to enable the Enterprise Edition transit router to automatically advertise routes to VPCs. Valid values:

  • false: (default)
  • true
true
Tagobject []No

The information about the tags.

You can specify at most 20 tags in each call.

KeystringNo

The tag key.

The tag key cannot be an empty string. The tag key can be up to 64 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.

You can specify at most 20 tag keys.

tagtest
ValuestringNo

The tag value.

The tag value can be 0 to 128 characters in length, and cannot start with aliyun or acs:. It cannot contain http:// or https://.

Each tag key must have a unique tag value. You can specify at most 20 tag values in each call.

tagtest

Response parameters

ParameterTypeDescriptionExample
object

The response.

TransitRouterAttachmentIdstring

The ID of the VPC connection.

tr-attach-ia340z7xis7t5s****
RequestIdstring

The ID of the request.

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

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400OperationUnsupported.TransitRouterRegionIdThe specified TransitRouterRegion does not support the operation.-
400NoPermission.AliyunServiceRoleForCENYou 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.The error message because you do not have the permissions to create the service-linked role whose role name is AliyunServiceRoleForCEN and service name is cen.aliyuncs.com. You must acquire the ram:CreateServiceLinkedRole permission before you can create the service-linked role.
400IllegalParam.RegionIdThe Specified Parameter RegionId is illegalThe error message returned because the specified region is invalid.
400MissingParam.CenIdOrRegionIdEither CenId or RegionId must be specified.The error message returned because the CenId or RegionId parameter is not set.
400IllegalParam.ZoneIdThe specified ZoneId is illegal.The error message returned because the specified zone is invalid.
400IllegalParam.ChargeTypeThe specified ChargeType is illegal.The error message returned because the specified billing method is invalid.
400InvalidTransitRouterId.NotFoundThe specified TransitRouterId is not found.The error message returned because the specified transit router does not exist.
400IncorrectStatus.VpcResourceThe resource is not in a valid state for the attachment operation.The error message returned because this operation is not supported when the specified VPC is in an unstable state. Wait until all operations related to the VPC are completed.
400IncorrectStatus.VpcThe resource is not in a valid state for the attachment operation.The error message returned because the status of the VPC does not support this operation. Try again later.
400IncorrectStatus.VpcOrVswitchThe Vpc Or Vswith is not in a valid state for the attachment operation.The error message returned because the status of the VPC or vSwitch does not support this operation. Try again later.
400OperationNotSupport.VpcAutoRoutesPublishAuto publish vpc routes is not supported in this region.The error message returned because automatic route advertising for VPCs is not supported in the specified region.
400InvalidOperation.VpnAssociatedThe operation is not supported because the VPC is associated with VPN.The error message returned because the specified VPC is associated with a VPN.
400Forbbiden.TransitRouterServiceNotOpenThe user has not open transit router service.The error message returned because the transit router is disabled. Enable the transit router and try again.
400IllegalParam.ZoneMappingsThe Specified Parameter ZoneMappings is illegalThe error message returned because the specified zone mappings (ZoneMappings) is invalid.
400OperationUnsupported.TransitRouterTypeThe specified TransitRouterType does not support the operation.The error message returned because this operation is not supported by the specified type of transit router.
400InvalidCenId.NotFoundCenId is not found.The error message returned because the specified CEN instance does not exist.
400IllegalParam.VSwitchIdVSwitchId is illegal.The error message returned because the specified vSwitch ID is invalid.
400IllegalParam.RegionIdRegionId is illegal.The error message returned because the specified region is invalid.
400IncorrectStatus.TransitRouterInstanceThe status of TransitRouter is incorrect.The error message returned because the transit router is in an invalid state.
400OperationUnsupported.CenFullLevelCEN full level does not support TransitRouterThe error message returned because CEN instances of the Full type do not support Enterprise Edition transit routers.
400IllegalParam.ServiceModeServiceMode is illegal.The error message returned because the specified service mode is invalid.
400QuotaFull.ChildInstanceRelatedCenThe childinstance has exceed the quota of the times that a childinstance can be attached as an attachment.The error message returned because the number of CEN instances to which the instance is attached has reached the upper limit. You cannot attach the instance to more CEN instances.
400OperationUnsupported.CloudBoxVswNotSupportCloud Box vsw does not support.The error message returned because the instance cannot be connected to the CloudBox vSwitch.
400IncorrectStatus.TransitRouterThe status of TransitRouter is incorrect.The error message returned because the status of the transit router does not support this operation. Try again later.
400Duplicated.ZoneMappingThe parameter ZoneMapping is duplicated.The error message returned because the zone mapping contains duplicate routes.
400QuotaExceeded.CenQuotaVpcAttachPerTransitRouterThe maximum number of VPC attachment per Transit Router is exceeded.The error message returned because the specified number of VPCs to be attache to the transit router exceeds the upper limit.
400IncorrectStatus.VpcRouteTableThe VPC route table is not in a desired state.The error message returned because the VPC route table is in an unstable state. Try again later.
400InvalidStatus.VpcAttachedFullModeCenThe VPC has been attached to another CEN instance whose protection level is FULL.The error message returned because the specified VPC is already attached to a CEN instance whose protection level is FULL. The VPC cannot be attached to other CEN instances.
400Forbbiden.AttachChildInstanceAcrossBidVPCs that belong to another BID cannot be associated. You need to apply for cross-BID attaching.The error message returned because you cannot associate with VPCs that belong to another BID.
400InvalidOperation.VpcAutoRoutesPublishInOtherCENThe specified VPC already has its routes synchronized with another CEN instance.The error message returned because this operation is not supported when route synchronization is enabled between the current VPC and another CEN instance.
400QuotaExceeded.VpcAutoRoutesPublishPerTransitRouterThe number of VPCs that have route synchronization enabled has reached the upper limit.The error message returned because the number of VPCs that have route synchronization enabled has reached the upper limit.
400InsufficientIpAddr.vswInsufficient available IP addresses in the vSwitch.The error message returned because the number of available IP addresses in the vSwitch is insufficient.
400Forbidden.ResourceOwnerTransitRouterServiceNotOpenThe resource owner user has not opened transit router service.The transit router service for the resource owner's account is not currently opened. Please inform them to open the transit router service and then try again.
400InvalidParameterInvalid parameter.The error message returned because the parameter is set to an invalid value.
400UnauthorizedThe AccessKeyId is unauthorized.The error message returned because you do not have the permissions to perform this operation.
404InvalidVSwitchId.NotFoundThe specified VSwitchId is not found.The error message returned because the specified vSwitch ID does not exist.
409InvalidOperation.CenInstanceStatusThe CEN instance is not in a valid state for the operation.The error message returned because the status of the CEN instance does not support this operation.
409IncorrectStatus.VpcSwitchThe resource is not in a valid state for the attachment operation.The error message returned because the status of the vSwitch does not support this operation. Try again later.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-01-10The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 404
    delete Error Codes: 409
2023-09-08The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 409 change
    delete Error Codes: 400
    delete Error Codes: 404
2023-03-14The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 404
    delete Error Codes: 409
2023-01-04The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 409
2022-12-22The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    Added Error Codes: 409
2022-10-19The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
Input ParametersThe request parameters of the API has changed.
    delete Input Parameters: AutoPublishRouteEnabled