All Products
Search
Document Center

Cloud Enterprise Network:CreateTransitRouterVpnAttachment

Last Updated:Oct 22, 2024

Attaches an IPsec-VPN connection to a transit router.

Operation description

  • By default, route learning and associated forwarding are disabled between transit router route tables and IPsec-VPN attachments.
  • When you call CreateTransitRouterVpnAttachment, if you set CenId and RegionId, you do not need to set TransitRouterId. If you set TransitRouterId and RegionId, you do not need to set CenId.

Prerequisites

  • Before you attach an IPsec-VPN connection to a transit router, make sure that at least one IPsec-VPN connection is created in the region where the transit router is deployed. Make sure the IPsec-VPN connection is not associated with a resource. For more information, see CreateVpnAttachment .
  • If the IPsec-VPN connection to be attached to the transit router belongs to a different Alibaba Cloud account, make sure that the transit router has obtained the required permissions from the IPsec-VPN connection. For more information, see GrantInstanceToTransitRouter .

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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.
OperationAccess levelResource typeCondition keyAssociated operation
cen:CreateTransitRouterVpnAttachmentcreate
  • CenInstance
    acs:cen:*:{#accountId}:ceninstance/{#ceninstanceId}
  • TransitRouter
    acs:cen:*:{#accountId}:centransitrouter/{#TransitRouterId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ClientTokenstringNo

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 all requests. The token 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 for each API request may be different.
123e4567-e89b-12d3-a456-42665544****
DryRunbooleanNo

Specifies whether to perform a dry run. Valid values:

  • true: performs a dry run. The system checks the required parameters, request syntax, and limits. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned.
  • false (default): performs a dry run and sends the request.
false
CenIdstringNo

The ID of the Cloud Enterprise Network (CEN) instance.

cen-rsgxs8ng2awen2****
TransitRouterIdstringNo

The ID of the transit router.

tr-p0wm740vjnbaprv0m****
RegionIdstringNo

The ID of the region where the transit router is deployed.

You can call the DescribeChildInstanceRegions operation to query the most recent region list.

cn-hangzhou
TransitRouterAttachmentNamestringNo

The name of the VPN attachment.

The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter.

nametest
TransitRouterAttachmentDescriptionstringNo

The description of the VPN attachment.

The description must be 2 to 256 characters in length. The description must start with a letter but cannot start with http:// or https://.

desctest
VpnIdstringYes

The ID of the IPsec-VPN attachment.

vco-p0w042cqwvlhl4zyw****
VpnOwnerIdlongNo

The ID of the Alibaba Cloud account to which the IPsec-VPN connection belongs.

  • If you do not set this parameter, the ID of the current Alibaba Cloud account is used.
  • You must set VpnOwnerId if you want to connect the transit router to an IPsec-VPN connection that belongs to another Alibaba Cloud account.
1210123456123456
AutoPublishRouteEnabledbooleanNo

Specifies whether to allow the transit router to automatically advertise routes to the IPsec-VPN attachment. Valid values:

  • true (default): yes
  • false: no
true
ChargeTypestringNo

The billing method.

Set the value to POSTPAY, which is the default value and specifies the pay-as-you-go billing method.

POSTPAY
Zonearray<object>Yes

The ID of the zone in the current region.

Resources are deployed in the specified zone.

objectYes

The ID of the zone where the instance resides.

ZoneIdstringYes

The zone ID of the read-only instance.

You can call the ListTransitRouterAvailableResource operation to query the most recent zone list.

cn-hangzhou-h
Tagarray<object>No

The tags.

You can specify at most 20 tags in each call.

objectNo

The information about the tags.

KeystringNo

The tag key.

The tag keys cannot be an empty string. The tag key can be up to 64 characters in length, and cannot start with acs: or aliyun. It cannot contain http:// or https://.

You can specify at most 20 tag keys.

TagKey
ValuestringNo

The tag value.

The tag value can be 0 to 128 characters in length, and cannot start with aliyun or acs:. It cannot contain http:// or https://.

Each tag key must have a unique tag value. You can specify at most 20 tag values in each call.

TagValue

Response parameters

ParameterTypeDescriptionExample
object

The response.

TransitRouterAttachmentIdstring

The ID of the VPN attachment.

tr-attach-y5dup2qwfyh9lu****
RequestIdstring

The ID of the request.

8B5DD40A-3A29-5AC0-B8DA-05FD10D5C893

Examples

Sample success responses

JSONformat

{
  "TransitRouterAttachmentId": "tr-attach-y5dup2qwfyh9lu****",
  "RequestId": "8B5DD40A-3A29-5AC0-B8DA-05FD10D5C893"
}

Error codes

HTTP status codeError codeError messageDescription
400NoPermission.AliyunServiceRolePolicyForCENYou 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.
400OperationUnsupported.TransitRouterRegionIdThe specified TransitRouterRegion does not support the operation.-
400InvalidCenId.NotFoundCenId is not found.The error message returned because the specified CEN instance does not exist.
400InvalidStatus.ResourceStatusThe 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.
400InvalidTransitRouterId.NotFoundTransitRouterId is not found.The error message returned because the ID of the transit router does not exist.
400Forbbiden.TransitRouterServiceNotOpenThe user has not open transit router service.The error message returned because the transit router is disabled. Enable the transit router and try again.
400InvalidTransitRouterMode.NeedUpgradeTransitRouter need to upgrade.The error message returned because the specified transit router mode is not supported.
400InvalidAvailable.NoResourceNo resource in the available zone.The error message returned because resources are insufficient in the specified region.
400OperationUnsupported.VpnAttachmentThe specified region does not support the operation.The error message returned because this operation is not supported in the specified region.
400OperationUnsupported.TransitRouterTypeThe specified TransitRouterType does not support the operation.The error message returned because this operation is not supported by the specified type of transit router.
400OperationFailed.AllocateCidrFailedOperation failed because vpn allocate cidr failed.The error message returned because the VPN failed to apply for a CIDR block.
400OperationUnsupported.ZoneIdThe specified ZoneId does not support the operation.-
400MissingParam.CenIdOrRegionIdEither CenId or RegionId must be specified.The error message returned because the CenId or RegionId parameter is not set.
400IllegalParam.RegionIdRegionId is illegal.The error message returned because the specified region is invalid.
400OperationUnsupported.CenFullLevelCEN full level does not support TransitRouterThe error message returned because CEN instances of the Full type do not support Enterprise Edition transit routers.
400InvalidOperation.CenInstanceStatusThe CEN instance is not in a valid state for the operation. -
400IllegalParam.ZoneMappingsThe Specified Parameter ZoneMappings is illegalThe error message returned because the specified zone mappings (ZoneMappings) is invalid.
400IncorrectStatus.TransitRouterThe status of TransitRouter is incorrect.The error message returned because the status of the transit router does not support this operation. Try again later.
400InvalidOperation.VpnNetworkTypeInvalidThe network type of child-instance is invalid.The error message returned because the network type specified for the instance is invalid.
400QuotaExceeded.CenQuotaVpnAttachPerTransitRouterThe 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.
400QuotaFull.ChildInstanceRelatedCenThe 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.
400Forbidden.ResourceOwnerTransitRouterServiceNotOpenThe 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.
400InvalidParameterInvalid parameter.The error message returned because the parameter is set to an invalid value.
400UnauthorizedThe AccessKeyId is unauthorized.The error message returned because you do not have the permissions to perform this operation.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-01-04The Error code has changedView Change Details
2022-12-22The Error code has changedView Change Details