A transit router supports ipsec-vpn connections to a vpn gateway. Your on-premises data center can connect directly to the transit router over an ipsec-vpn connection to communicate with other networks. To create a vpn attachment, call the CreateTransitRouterVpnAttachment operation.
Operation description
By default, a newly created VPN connection has no route learning relationship or forwarding association with any Transit Router route table.
When calling the
CreateTransitRouterVpnAttachmentoperation, you can omit TransitRouterId by specifying CenId and RegionId. Conversely, you can omit CenId by specifying TransitRouterId and RegionId.
Prerequisites
Before creating a VPN connection, you must create an IPsec connection in the same region as the Transit Router instance. The IPsec connection must not be bound to any other resource. For more information, see CreateVpnAttachment.
To connect a Transit Router instance to a cross-account IPsec connection, the IPsec connection must first be granted to the Transit Router instance. For more information, see GrantInstanceToTransitRouter.
Before creating a VPN connection, you must configure a TR CIDR block for the Transit Router. For more information, see CreateTransitRouterCidr.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
cen:CreateTransitRouterVpnAttachment |
create |
CenInstance
TransitRouter
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ClientToken |
string |
No |
A client-generated token that you can use to ensure the idempotence of your request. You must ensure that the token is unique across different requests. The client token can contain only ASCII characters. Note
If you omit this parameter, the system uses the RequestId of the request as the ClientToken. The RequestId is unique for each API request. |
123e4567-e89b-12d3-a456-42665544**** |
| DryRun |
boolean |
No |
Specifies whether to perform a dry run. Valid values:
|
false |
| CenId |
string |
No |
The ID of the CEN instance. |
cen-rsgxs8ng2awen2**** |
| TransitRouterId |
string |
No |
The ID of the transit router. |
tr-p0wm740vjnbaprv0m**** |
| RegionId |
string |
No |
The ID of the region where the transit router is deployed. You can call the DescribeChildInstanceRegions operation to query region IDs. |
cn-hangzhou |
| TransitRouterAttachmentName |
string |
No |
The name of the VPN attachment. The name can be empty or 1 to 128 characters in length, and cannot start with |
nametest |
| TransitRouterAttachmentDescription |
string |
No |
The description of the VPN connection. The description can be empty or 1 to 256 characters in length, and cannot start with |
desctest |
| VpnId |
string |
Yes |
The ID of the IPsec-VPN connection. |
vco-p0w042cqwvlhl4zyw**** |
| VpnOwnerId |
integer |
No |
The ID of the Alibaba Cloud account (root account) to which the IPsec-VPN connection belongs.
|
1210123456123456 |
| AutoPublishRouteEnabled |
boolean |
No |
Specifies whether to automatically advertise routes from the transit router to the IPsec-VPN connection. Valid values:
|
true |
| ChargeType |
string |
No |
The billing method. The default and only valid value is POSTPAY, which specifies the pay-as-you-go billing method. |
POSTPAY |
| Zone |
array<object> |
No |
The ID of the zone. The system creates the required resources in the specified zone. Note
This parameter is not required if the associated IPsec-VPN connection uses dual-tunnel mode. |
|
|
object |
No |
The zone ID. |
||
| ZoneId |
string |
No |
The ID of the zone. You can call the ListTransitRouterAvailableResource operation to query available zone IDs. |
cn-hangzhou-h |
| Tag |
array<object> |
No |
A list of tags. You can add up to 20 tags. |
|
|
object |
No |
The tag. |
||
| Key |
string |
No |
The tag key. The tag key must be 1 to 64 characters in length. It cannot start with |
TagKey |
| Value |
string |
No |
The tag value. The tag value must be 0 to 128 characters in length. It cannot start with |
TagValue |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response data. |
||
| TransitRouterAttachmentId |
string |
The ID of the VPN connection. |
tr-attach-y5dup2qwfyh9lu**** |
| RequestId |
string |
The ID of the request. |
8B5DD40A-3A29-5AC0-B8DA-05FD10D5C893 |
Examples
Success response
JSON format
{
"TransitRouterAttachmentId": "tr-attach-y5dup2qwfyh9lu****",
"RequestId": "8B5DD40A-3A29-5AC0-B8DA-05FD10D5C893"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 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. | The error message returned because you do not have the permissions to create the service-linked role whose role name is AliyunServiceRolePolicyForCEN and service name is cen.aliyuncs.com. You must acquire the ram:CreateServiceLinkedRole permission before you can create the service-linked role. |
| 400 | OperationUnsupported.TransitRouterRegionId | The specified TransitRouterRegion does not support the operation. | |
| 400 | InvalidCenId.NotFound | CenId is not found. | The error message returned because the specified CEN instance does not exist. |
| 400 | InvalidStatus.ResourceStatus | The resource is not in a valid state for the attachment operation. | The error message returned because the status of the specified resource does not support this operation. Try again later. |
| 400 | InvalidTransitRouterId.NotFound | TransitRouterId is not found. | The error message returned because the ID of the transit router does not exist. |
| 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 | InvalidTransitRouterMode.NeedUpgrade | TransitRouter need to upgrade. | The error message returned because the specified transit router mode is not supported. |
| 400 | InvalidAvailable.NoResource | No resource in the available zone. | The error message returned because resources are insufficient in the specified region. |
| 400 | OperationUnsupported.VpnAttachment | The specified region does not support the operation. | The error message returned because this operation is not supported in the specified region. |
| 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 | OperationFailed.AllocateCidrFailed | Operation failed because vpn allocate cidr failed. | The error message returned because the VPN failed to apply for a CIDR block. |
| 400 | OperationUnsupported.ZoneId | The specified ZoneId does not support the operation. | |
| 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.RegionId | RegionId is illegal. | The error message returned because the specified region is invalid. |
| 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 | InvalidOperation.CenInstanceStatus | The CEN instance is not in a valid state for the operation. | |
| 400 | IllegalParam.ZoneMappings | The Specified Parameter ZoneMappings is illegal | The error message returned because the specified zone mappings (ZoneMappings) is invalid. |
| 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 | InvalidOperation.VpnNetworkTypeInvalid | The network type of child-instance is invalid. | The error message returned because the network type specified for the instance is invalid. |
| 400 | QuotaExceeded.CenQuotaVpnAttachPerTransitRouter | The maximum number of VPN attachment per Transit Router is exceeded. | The error message returned because specified number of VPN attachments to the transit router exceeds the upper limit. You can submit a ticket to request a quota increase. |
| 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 | 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 | OperationUnsupported.VcoTunnelNotMatchZoneParam | The tunnel type of the entered Vco does not match the Zone parameter. | The tunnel type of the entered Vco does not match the Zone parameter. |
| 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 | IllegalParam.TransitRouterRegionId | TransitRouterRegionId is illegal. | The error message returned because the specified transit router region ID (TransitRouterRegionId) is invalid. |
| 400 | InvalidVpnId.NotFound | The specified vpn connection instance id does not exist. | The specified vpn connection instance id does not exist. |
| 400 | InvalidParameter.ResourceType | The specified parameter ResourceType is invalid. | |
| 400 | InvalidParameter.VpnId | The specified parameter VpnId is invalid. | |
| 400 | IllegalParam.ChargeType | The specified ChargeType is illegal. | The error message returned because the specified billing method is invalid. |
| 400 | Forbidden.AttachChildInstanceAcrossBid | Operation is not supported for current account. | Operation is not supported for current account. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.