Creates a virtual private cloud (VPC) connection on an Enterprise Edition transit router.
Usage notes
- You can use the following methods to create a VPC connection on 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 ListTransitRouterVpcAttachments to query the status of a VPC connection.
- If a VPC 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.
Debugging
Request parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| Action | String | Yes | CreateTransitRouterVpcAttachment |
The operation that you want to perform. Set the value to CreateTransitRouterVpcAttachment. |
| ClientToken | String | No | 02fb3da4-130e-11e9-8e44-001**** |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that it is unique among all requests. ClientToken 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 may be different for each API request.
|
| CenId | String | No | cen-j3jzhw1zpau2km**** |
The ID of the Cloud Enterprise Network (CEN) instance. |
| TransitRouterId | String | No | tr-bp1su1ytdxtataupl**** |
The ID of the Enterprise Edition transit router. |
| RegionId | String | No | cn-hangzhou |
The ID of the region where the VPC is deployed. You can call the DescribeChildInstanceRegions operation to query the most recent region list. |
| TransitRouterAttachmentName | String | No | testname |
The name of the VPC connection. The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter. |
| TransitRouterAttachmentDescription | String | No | testname |
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 |
| VpcId | String | Yes | vpc-bp1kbjcre9vtsebo1**** |
The ID of the VPC. |
| VpcOwnerId | Long | No | 1250123456123456 |
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 you want to connect to a network instance that belongs to another account, this
parameter is required.
|
| ChargeType | String | No | POSTPAY |
The billing method. Default value: POSTPAY, which specifies the pay-as-you-go billing method. |
| DryRun | Boolean | No | false |
Specifies whether to check the request but not perform the operation. The system checks the permissions and the status of the specified instances. Default values:
|
| ZoneMappings.N.VSwitchId | String | Yes | vsw-bp1a214sbus8z3b54**** |
Select a vSwitch that is deployed in a zone supported by Enterprise Edition transit routers. You can specify vSwitches for at most 10 zones in each call. |
| ZoneMappings.N.ZoneId | String | Yes | cn-hangzhou-h |
The ID of the zone supported by Enterprise Edition transit routers. You can call the DescribeZones operation to query zone IDs. You can specify at most 10 zones in each call. |
| Tag.N.Key | String | No | tagtest |
The tag keys of the resources. The tag keys cannot be an empty string. The tag keys can be up to 64 characters in
length and cannot start with You can specify at most 20 tag keys. |
| Tag.N.Value | String | No | tagtest |
The tag values of the resources. The tag values can be 0 to 128 characters in length, and cannot start with Each tag key has a unique tag value. You can specify at most 20 tag values in each call. |
Response parameters
| Parameter | Type | Example | Description |
|---|---|---|---|
| TransitRouterAttachmentId | String | tr-attach-ia340z7xis7t5s**** |
The ID of the VPC connection. |
| RequestId | String | C087A369-82B9-43EF-91F4-4B63A9C6E6B6 |
The ID of the request. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=CreateTransitRouterVpcAttachment
&ClientToken=02fb3da4-130e-11e9-8e44-001****
&CenId=cen-j3jzhw1zpau2km****
&TransitRouterId=tr-bp1su1ytdxtataupl****
&RegionId=cn-hangzhou
&TransitRouterAttachmentName=testname
&TransitRouterAttachmentDescription=testname
&VpcId=vpc-bp1kbjcre9vtsebo1****
&VpcOwnerId=1250123456123456
&ChargeType=POSTPAY
&DryRun=false
&ZoneMappings=[{"VSwitchId":"vsw-bp1a214sbus8z3b54****","ZoneId":"cn-hangzhou-h"}]
&Tag=[{"Key":"tagtest","Value":"tagtest"}]
&<Common request parameters>
Sample success responses
XML format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateTransitRouterVpcAttachmentResponse>
<TransitRouterAttachmentId>tr-attach-ia340z7xis7t5s****</TransitRouterAttachmentId>
<RequestId>C087A369-82B9-43EF-91F4-4B63A9C6E6B6</RequestId>
</CreateTransitRouterVpcAttachmentResponse>
JSON format
HTTP/1.1 200 OK
Content-Type:application/json
{
"TransitRouterAttachmentId" : "tr-attach-ia340z7xis7t5s****",
"RequestId" : "C087A369-82B9-43EF-91F4-4B63A9C6E6B6"
}
Error codes
| HttpCode | Error code | Error message | Description |
|---|---|---|---|
| 400 | OperationUnsupported.TransitRouterRegionId | The specified TransitRouterRegion does not support the operation. | The error message returned because the specified region 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 returned because you are unauthorized to create the service-linked role AliyunServiceRoleForCEN for the service cen.aliyuncs.com. You must acquire the ram:CreateServiceLinkedRole permission before you can perform the operation. |
| 400 | MissingParam.CenIdOrRegionId | Either CenId or RegionId must be specified. | The error message returned because CenId or RegionId 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.Attachment | The resource is not in a valid state for the attachment operation. | The error message returned because the operation is not allowed when the network instance is being processed. Try again later. |
| 400 | IncorrectStatus.Vpc | The resource is not in a valid state for the attachment operation. | The error message returned because the operation is not allowed when the network instance is being processed. Try again later. |
| 400 | Forbbiden.TransitRouterServiceNotOpen | The user has not open transit router service. | The error message returned because the transit router feature is not activated. Activate the feature and try again. |
| 400 | OperationUnsupported.TransitRouterType | The specified TransitRouterType does not support the operation. | The error message returned because this type of transit router does not support this operation. |
| 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 VSwitchId is set to an invalid value. |
| 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 types do not support Enterprise Edition transit routers. |
For a list of error codes, see Service error codes.