Calls the CreateTransitRouterVpcAttachment operation to attach a Virtual Private Cloud (VPC) instance to an Enterprise Edition transit router instance to enable private network peering. After the attachment is created, the transit router instance helps you implement private network connectivity through forwarding and routing.
Operation description
-
You can create a VPC attachment for an Enterprise Edition transit router in two ways:
If you have already created an Enterprise Edition transit router instance in the target region, specify VpcId, ZoneMappings.N.VSwitchId, ZoneMappings.N.ZoneId, TransitRouterId, and RegionId to create the VPC attachment.
If you have not created an Enterprise Edition transit router instance in the target region, specify VpcId, ZoneMappings.N.VSwitchId, ZoneMappings.N.ZoneId, CenId, and RegionId to create the VPC attachment. The system uses automatic creation to create an Enterprise Edition transit router instance when you create the VPC attachment.
-
CreateTransitRouterVpcAttachment is an asynchronous operation. The system returns a VPC attachment ID before the VPC attachment is created. The creation task runs in the background. Call ListTransitRouterVpcAttachments to query the status of the VPC attachment.
When the VPC attachment is in the Attaching state, the VPC attachment is being created. In this state, you can only query the VPC attachment and cannot execute other operations.
When the VPC attachment is in the Attached state, the VPC attachment is created.
-
After a VPC attachment is created, it does not associate with any transit router route table for route learning relationships or forwarding relationships by default.
Before you begin
Before you call this operation to create a VPC attachment, make sure that the following requirements are met:
The VPC instance has at least one vSwitch instance with at least one available IP address in a zone supported by the Enterprise Edition transit router. For information about the regions and zones supported by Enterprise Edition transit routers, see Regions and zones supported by Enterprise Edition transit routers.
If you want to attach a VPC-connected instance that belongs to a different account, obtain cross-account authorization first. For more information, see Cross-account VPC-connected instance authorization.
Creating a VPC attachment incurs fees. Make sure that you understand the billing rules. For more information, see Billing.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
cen:CreateTransitRouterVpcAttachment |
create |
CenInstance
TransitRouter
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ClientToken |
string |
No |
The client token that is used to ensure the idempotence of the request. Generate a unique value from your client for this parameter. ClientToken supports only ASCII characters. Note
If you do not specify this parameter, the system uses the RequestId of the API request as the ClientToken. The RequestId of each API request is different. |
02fb3da4-130e-11e9-8e44-001**** |
| CenId |
string |
No |
The instance ID of the Cloud Enterprise Network (CEN). |
cen-j3jzhw1zpau2km**** |
| TransitRouterId |
string |
No |
The instance ID of the Enterprise Edition transit router. |
tr-bp1su1ytdxtataupl**** |
| RegionId |
string |
No |
The ID of the region where the VPC instance is deployed. You can call DescribeChildInstanceRegions to query region IDs. |
cn-hangzhou |
| TransitRouterAttachmentName |
string |
No |
The name of the VPC attachment. The name can be left empty or can contain 1 to 128 characters. It cannot start with http:// or https://. |
testname |
| TransitRouterAttachmentDescription |
string |
No |
The description of the VPC attachment. The description can be left empty or can contain 1 to 256 characters. It cannot start with http:// or https://. |
testname |
| VpcId |
string |
Yes |
The instance ID of the VPC. |
vpc-bp1kbjcre9vtsebo1**** |
| VpcOwnerId |
integer |
No |
The ID of the Alibaba Cloud account to which the VPC instance belongs. The default value is the ID of the current logon Alibaba Cloud account. Note
This parameter is required if you want to attach a network instance that belongs to a different account. |
1250123456123456 |
| ChargeType |
string |
No |
The billing method. Default value: POSTPAY, which indicates the pay-as-you-go billing method. |
POSTPAY |
| DryRun |
boolean |
No |
Specifies whether to perform a dry run on the request, including permission checks and instance status validation. Valid values:
|
false |
| ZoneMappings |
array<object> |
Yes |
Select a vSwitch instance in a zone supported by the Enterprise Edition transit router. You can add up to 10 entries at a time. |
|
|
object |
No |
The information about the zones supported by the Enterprise Edition transit router and the corresponding vSwitch instances. |
||
| VSwitchId |
string |
Yes |
The vSwitch instance in a zone supported by the Enterprise Edition transit router. You can select vSwitch instances for up to 10 zones at a time. |
vsw-bp1a214sbus8z3b54**** |
| ZoneId |
string |
Yes |
The ID of a zone supported by the Enterprise Edition transit router. You can call DescribeZones to query zone IDs. You can select up to 10 zones at a time. |
cn-hangzhou-h |
| AutoPublishRouteEnabled |
boolean |
No |
Specifies whether the Enterprise Edition transit router automatically publishes route entries to the VPC instance.
|
true |
| TransitRouterVPCAttachmentOptions |
object |
No |
The list of feature attributes for the VPC attachment (to be deprecated — use the new Options parameter instead). |
|
|
string |
No |
The feature attribute for the VPC attachment (to be deprecated — use the new Options parameter instead). ipv6Support: specifies whether to enable IPv6.
Note
Before enabling IPv6 for a VPC attachment, make sure that the VPC instance and its associated vSwitch instances have IPv6 enabled. For more information, see AllocateVpcIpv6Cidr and CreateVSwitchCidrReservation. |
disable |
|
| Tag |
array<object> |
No |
The list of tags. You can specify up to 20 tags at a time. |
|
|
object |
No |
The tag. |
||
| Key |
string |
No |
The tag key of the resource. If this parameter is specified, it cannot be an empty string. The tag key can be up to 64 characters in length and cannot start with You can specify up to 20 tag keys at a time. |
tagtest |
| Value |
string |
No |
The tag value of the resource. If this parameter is specified, it cannot be empty. The tag value can be up to 128 characters in length and cannot start with aliyun or acs:. It cannot contain http:// or https://. Each tag key corresponds to one tag value. You can specify up to 20 tag key-value pairs at a time. |
tagtest |
| Options |
object |
No |
The collection of feature attributes. |
|
| ApplianceModeSupport |
string |
No |
Specifies whether to enable the network appliance traffic redirection mode.
|
enable |
| Ipv6Support |
string |
No |
Specifies whether to enable IPv6 support.
|
enable |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response result. |
||
| RequestId |
string |
The request ID. |
C087A369-82B9-43EF-91F4-4B63A9C6E6B6 |
| TransitRouterAttachmentId |
string |
The ID of the VPC attachment. |
tr-attach-ia340z7xis7t5s**** |
Examples
Success response
JSON format
{
"RequestId": "C087A369-82B9-43EF-91F4-4B63A9C6E6B6",
"TransitRouterAttachmentId": "tr-attach-ia340z7xis7t5s****"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 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. | 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. |
| 400 | IllegalParam.RegionId | The Specified Parameter RegionId is illegal | The error message returned because the specified region is invalid. |
| 400 | MissingParam.CenIdOrRegionId | Either CenId or RegionId must be specified. | The error message returned because the CenId or RegionId parameter is not set. |
| 400 | IllegalParam.ZoneId | The specified ZoneId is illegal. | The error message returned because the specified zone is invalid. |
| 400 | IllegalParam.ChargeType | The specified ChargeType is illegal. | The error message returned because the specified billing method is invalid. |
| 400 | InvalidTransitRouterId.NotFound | The specified TransitRouterId is not found. | The error message returned because the specified transit router does not exist. |
| 400 | IncorrectStatus.VpcResource | The 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. |
| 400 | IncorrectStatus.Vpc | The 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. |
| 400 | IncorrectStatus.VpcOrVswitch | The 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. |
| 400 | OperationNotSupport.VpcAutoRoutesPublish | Auto 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. |
| 400 | InvalidOperation.VpnAssociated | The operation is not supported because the VPC is associated with VPN. | The error message returned because the specified VPC is associated with a VPN. |
| 400 | Forbbiden.TransitRouterServiceNotOpen | The user has not open transit router service. | The error message returned because the transit router is disabled. Enable the transit router and try again. |
| 400 | IllegalParam.ZoneMappings | The Specified Parameter ZoneMappings is illegal | The error message returned because the specified zone mappings (ZoneMappings) is invalid. |
| 400 | OperationUnsupported.TransitRouterType | The specified TransitRouterType does not support the operation. | The error message returned because this operation is not supported by the specified type of transit router. |
| 400 | InvalidCenId.NotFound | CenId is not found. | The error message returned because the specified CEN instance does not exist. |
| 400 | IllegalParam.VSwitchId | VSwitchId is illegal. | The error message returned because the specified vSwitch ID is invalid. |
| 400 | IncorrectStatus.TransitRouterInstance | The status of TransitRouter is incorrect. | The error message returned because the transit router is in an invalid state. |
| 400 | OperationUnsupported.CenFullLevel | CEN full level does not support TransitRouter | The error message returned because CEN instances of the Full type do not support Enterprise Edition transit routers. |
| 400 | IllegalParam.ServiceMode | ServiceMode is illegal. | The error message returned because the specified service mode is invalid. |
| 400 | QuotaFull.ChildInstanceRelatedCen | The 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. |
| 400 | OperationUnsupported.CloudBoxVswNotSupport | Cloud Box vsw does not support. | The error message returned because the instance cannot be connected to the CloudBox vSwitch. |
| 400 | IncorrectStatus.TransitRouter | The status of TransitRouter is incorrect. | The error message returned because the status of the transit router does not support this operation. Try again later. |
| 400 | Duplicated.ZoneMapping | The parameter ZoneMapping is duplicated. | The error message returned because the zone mapping contains duplicate routes. |
| 400 | QuotaExceeded.CenQuotaVpcAttachPerTransitRouter | The 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. |
| 400 | IncorrectStatus.VpcRouteTable | The 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. |
| 400 | InvalidStatus.VpcAttachedFullModeCen | The 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. |
| 400 | Forbbiden.AttachChildInstanceAcrossBid | VPCs 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. |
| 400 | InvalidOperation.VpcAutoRoutesPublishInOtherCEN | The 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. |
| 400 | QuotaExceeded.VpcAutoRoutesPublishPerTransitRouter | The 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. |
| 400 | InsufficientIpAddr.vsw | Insufficient available IP addresses in the vSwitch. | The error message returned because the number of available IP addresses in the vSwitch is insufficient. |
| 400 | Forbidden.ResourceOwnerTransitRouterServiceNotOpen | The 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. |
| 400 | IllegalParam.TransitRouterRegionId | TransitRouterRegionId is illegal. | The error message returned because the specified transit router region ID (TransitRouterRegionId) is invalid. |
| 400 | InvalidTransitRouterMode.NeedUpgrade | TransitRouter need to upgrade. | The error message returned because the specified transit router mode is not supported. |
| 400 | IllegalParam.Ipv6Support | Ipv6Support is illegal. Valid Values are [enable, disable]. | The Ipv6Support value of the request parameter is invalid. The valid value is enable or disable. |
| 400 | OperationFailed.VSwitchNotFound | The specified vswitch not found. | The specified vswitch not found. |
| 400 | OperationFailed.VSwitchIpv6CidrNotAllocated | The specified vswitch does not have IPv6 address allocated. | The specified vswitch does not have IPv6 address allocated. |
| 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. | The transit router service of the account to which the resource belongs has been suspended. Please notify the other party to renew the service and try again. |
| 400 | Forbidden.TransitRouterServiceExpired | The transit router service is out of service. | The transit router service has been suspended due for payment. Please renew the service and try again. |
| 400 | InvalidParameter | Invalid parameter. | The error message returned because the parameter is set to an invalid value. |
| 400 | Unauthorized | The AccessKeyId is unauthorized. | The error message returned because you do not have the permissions to perform this operation. |
| 400 | InvalidParameter.ResourceType | The specified parameter ResourceType is invalid. | The ResourceType specified by the user is illegal. |
| 400 | ParamExclusive.TransitRouterVPCAttachmentOptionsAndOptions | When creating or modifying a VPC attachment, the input parameter TransitRouterVPCAttachmentOptions and Options cannot be used at the same time. | When creating or modifying a VPC attachment, the input parameter TransitRouterVPCAttachmentOptions and Options cannot be used at the same time. |
| 400 | InvalidParameter.ApplianceModeSupport | The specified parameter ApplianceModeSupport is invalid. | The parameter ApplianceModeSupport entered is illegal. |
| 400 | InvalidParameter.Ipv6Support | The specified parameter Ipv6Support is invalid. | The parameter Ipv6Support entered is illegal. |
| 400 | INVALID_OPERATION_RESOURCE_NOT_SUPPORT_APPLIANCE_MODE | Only VPC attachment support appliance mode. | Only VPC attachment support appliance mode. |
| 400 | InvalidParameter.TagValue | The specified parameter TagValue is invalid. | The input parameter Tag Value is invalid. |
| 400 | InvalidParameter.CenBandwidthPackageId | The specified parameter CenBandwidthPackageId is invalid. | The parameter CenBandwidthPackageId entered is illegal. |
| 400 | InvalidParameter.CenId | The specified parameter CenId is invalid. | The entered parameter CenId is invalid. |
| 400 | InvalidParameter.TransitRouterId | The specified parameter TransitRouterId is invalid. | The parameter TransitRouterId entered is illegal. |
| 400 | InvalidParameter.AssociateRouteTableId | The specified parameter AssociateRouteTableId is invalid. | The parameter AssociateRouteTableId entered is illegal. |
| 400 | OperationFailed.PostPay95BwpNotAllowEnterpriseTr | Cbn with post pay 95 bandwidth package does not allow enterprise tr. | Cbn with post pay 95 bandwidth package does not allow enterprise tr. |
| 400 | OperationUnsupported.VpcRoutePropagationSource | The operation on this VPC route propagation source is not supported. | The operation on this VPC route propagation source is not supported. |
| 404 | InvalidVSwitchId.NotFound | The specified VSwitchId is not found. | The error message returned because the specified vSwitch ID does not exist. |
| 409 | InvalidOperation.CenInstanceStatus | The 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. |
| 409 | IncorrectStatus.VpcSwitch | The resource is not in a valid state for the attachment operation. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.