Connects a virtual private cloud (VPC) to an Enterprise Edition transit router.
Operation Description
You can use the following methods to connect 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 system returns a VPC connection ID and runs the task in the 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:
- At least one vSwitch is deployed for the VPC in the zones supported by Enterprise Edition transit routers. Each vSwitch must have at least one idle IP address. For more information, see Regions and zones supported by Enterprise Edition transit routers.
- To connect to a network instance that belongs to another Alibaba Cloud account, you must first acquire the required permissions from the account. For more information, see Acquire permissions to connect to a network instance that belongs to another account.
- VPC connections incur fees. Take note of the billing rules of VPC connections before you create a VPC connection. For more information, see Billing.
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.
Operation | Access level | Resource type | Condition key | Association operation |
---|---|---|---|---|
cen:CreateTransitRouterVpcAttachment | Write |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ClientToken | string | No | 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. NoteIf 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**** |
CenId | string | No | The ID of the Cloud Enterprise Network (CEN) instance. | cen-j3jzhw1zpau2km**** |
TransitRouterId | string | No | The ID of the Enterprise Edition transit router. | tr-bp1su1ytdxtataupl**** |
RegionId | string | No | 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 |
TransitRouterAttachmentName | string | No | The name of the VPC connection. The name must be 2 to 128 characters in length, and can contain digits, underscores (_), and hyphens (-). It must start with a letter. | testname |
TransitRouterAttachmentDescription | string | No | The description of the VPC connection. The description must be 2 to 256 characters in length. The description must start with a letter but cannot start with | testname |
VpcId | string | Yes | The ID of the VPC. | vpc-bp1kbjcre9vtsebo1**** |
VpcOwnerId | long | No | The ID of the Alibaba Cloud account to which the VPC belongs. The default value is the ID of the current Alibaba Cloud account. NoteIf the network instance and CEN instance belong to different Alibaba Cloud accounts, this parameter is required. | 1250123456123456 |
ChargeType | string | No | The billing method. Valid values: The default value is POSTPAY, which specifies the pay-as-you-go billing method. | POSTPAY |
DryRun | boolean | No | Specifies whether to perform a dry run to check information such as the permissions and the instance status. Valid values:
| false |
ZoneMappings | array | Yes | A vSwitch in a zone of the Enterprise Edition transit router. You can specify at most 10 vSwitches in each call. | |
object | No | The zone that supports Enterprise Edition transit routers and the information about the vSwitch in the zone. | ||
VSwitchId | string | Yes | A vSwitch in a zone of the Enterprise Edition transit router. You can specify vSwitches for at most 10 zones in each call. | vsw-bp1a214sbus8z3b54**** |
ZoneId | string | Yes | The ID of the zone supported by 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 |
Tag | array | No | The information about the tags. You can specify at most 20 tags in each call. | |
object | No | |||
Key | string | No | 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 You can specify at most 20 tag keys. | tagtest |
Value | string | No | The tag value. The tag value can be 0 to 128 characters in length, and cannot start with Each tag key must have a unique tag value. You can specify at most 20 tag values in each call. | tagtest |
Response parameters
Examples
Sample success responses
JSON
format
{
"TransitRouterAttachmentId": "tr-attach-ia340z7xis7t5s****",
"RequestId": "C087A369-82B9-43EF-91F4-4B63A9C6E6B6"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidStatus.VpcAttachedFullModeCen | Operation is invalid because the instance has already attached to other cen with protection level FULL | - |
400 | Forbbiden.AttachChildInstanceAcrossBid | Operation is invalid, please apply for cross-bid attaching. | - |
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.VpcAutoRoutesPublishInOtherCEN | The operation is not supported because the VPC is already set autoRoutesPublish in other CEN. | - |
400 | QuotaExceeded.VpcAutoRoutesPublishPerTransitRouter | The count of VPC instance which set autoRoutesPublish in transitRouter is over limit. | - |
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 | InvalidVSwitchId.NotFound | VSwitchId is not found. | - |
400 | IllegalParam.RegionId | RegionId is illegal. | The error message returned because the specified region 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 | 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 | 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. |
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. | - |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
2023-01-04 | The error codes of the API operation change. | |||||||||
| ||||||||||
2022-12-22 | The error codes of the API operation change. | |||||||||
| ||||||||||
2022-10-19 | The error codes of the API operation change.,The input parameters of the API operation change. | |||||||||
|