Creates a VPN attachment on a transit router. Transit routers support connections to IPsec-VPN connections of VPN gateways. An on-premises data center can connect to a transit router through an IPsec-VPN connection and then communicate with other networks through the transit router.
Operation description
After you create a VPN attachment, the VPN attachment is not associated with or does not learn routes from any transit router route table by default.
When you call the
CreateTransitRouterVpnAttachmentoperation, if you specify the CenId and RegionId parameters, you do not need to specify the TransitRouterId parameter. If you specify the TransitRouterId and RegionId parameters, you do not need to specify the CenId parameter.
Before you begin
Before you create a VPN attachment, make sure that you have created an IPsec-VPN connection in the region where the transit router instance resides and the IPsec-VPN connection is not associated with any resource. For more information, see CreateVpnAttachment.
If the transit router instance needs to connect to an IPsec-VPN connection that belongs to a different Alibaba Cloud account, make sure that the IPsec-VPN connection has granted permissions to the transit router instance. For more information, see GrantInstanceToTransitRouter.
Before you create a VPN attachment, make sure that you have configured the transit router CIDR block. 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 |
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 client token can contain only ASCII characters. Note
If you do not specify this parameter, the system automatically uses the RequestId of the API request as the ClientToken. The RequestId may be different 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 Cloud Enterprise Network (CEN) instance ID. |
cen-rsgxs8ng2awen2**** |
| TransitRouterId |
string |
No |
The transit router instance ID. |
tr-p0wm740vjnbaprv0m**** |
| RegionId |
string |
No |
The region ID of the transit router instance. You can call the DescribeChildInstanceRegions operation to query the region ID. |
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 http:// or https://. |
nametest |
| TransitRouterAttachmentDescription |
string |
No |
The description of the VPN attachment. The description can be empty or 1 to 256 characters in length, and cannot start with http:// or https://. |
desctest |
| VpnId |
string |
Yes |
The ID of the IPsec-VPN connection. |
vco-p0w042cqwvlhl4zyw**** |
| VpnOwnerId |
integer |
No |
The Alibaba Cloud account ID of the Alibaba Cloud account to which the IPsec-VPN connection belongs.
|
1210123456123456 |
| AutoPublishRouteEnabled |
boolean |
No |
Specifies whether to allow the transit router instance to automatically publish route entries to the IPsec-VPN connection. Valid values:
|
true |
| ChargeType |
string |
No |
The billable methods. Set the value to POSTPAY (default), which specifies the pay-as-you-go billing method based on usage. |
POSTPAY |
| Zone |
array<object> |
No |
The zone ID in the current region. The system creates resources in the zone that you specify. Note
If the IPsec-VPN connection uses the dual-tunnel mode, leave this parameter empty. |
|
|
object |
No |
The zone ID. |
||
| ZoneId |
string |
No |
The zone ID. You can call the ListTransitRouterAvailableResource operation to query the zone ID. |
cn-hangzhou-h |
| Tag |
array<object> |
No |
The tag information list. You can specify up to 20 tags at a time. |
|
|
object |
No |
The tag information. |
||
| Key |
string |
No |
The tag key of the resource. 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 up to 20 tag keys at a time. |
TagKey |
| Value |
string |
No |
The tag value of the resource. The tag value can be an empty string or up to 128 characters in length. It cannot start with Each tag key corresponds to one tag value. You can specify up to 20 tag values at a time. |
TagValue |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| TransitRouterAttachmentId |
string |
The ID of the VPN attachment. |
tr-attach-y5dup2qwfyh9lu**** |
| RequestId |
string |
The request ID. |
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. |
| 400 | InvalidParameter.TagValue | The specified parameter TagValue is invalid. | The input parameter Tag Value is invalid. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.