创建VPN连接。
接口说明
- 创建VPN连接后,VPN连接默认不与任何转发路由器路由表建立路由学习关系和关联转发关系。
- 在调用
CreateTransitRouterVpnAttachment
接口的过程中,如果您指定了CenId、RegionId参数的值,则无需指定TransitRouterId参数的值;如果您指定了TransitRouterId、RegionId参数的值,则无需指定CenId参数的值。
前提条件
- 在创建VPN连接前,请确保您已经在转发路由器实例所在的地域创建了一个IPsec连接,且IPsec连接未绑定任何资源。具体操作,请参见CreateVpnAttachment。
- 如果转发路由器实例需要连接跨账号的IPsec连接,则需确保IPsec连接已对转发路由器实例授权。具体操作,请参见GrantInstanceToTransitRouter。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
授权信息
请求参数
名称 | 类型 | 必填 | 描述 | 示例值 |
---|---|---|---|---|
ClientToken | string | 否 | 客户端Token,用于保证请求的幂等性。 从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken只支持ASCII字符。 说明若您未指定,则系统自动使用API请求的RequestId作为ClientToken标识。每次API请求的RequestId可能不一样。 | 123e4567-e89b-12d3-a456-42665544**** |
DryRun | boolean | 否 | 是否只预检此次请求。取值:
| false |
CenId | string | 否 | 云企业网实例ID。 | cen-rsgxs8ng2awen2**** |
TransitRouterId | string | 否 | 转发路由器实例ID。 | tr-p0wm740vjnbaprv0m**** |
RegionId | string | 否 | 转发路由器实例所属的地域ID。 您可以通过调用DescribeChildInstanceRegions接口获取地域ID。 | ap-southeast-2 |
TransitRouterAttachmentName | string | 否 | VPN连接的名称。 名称长度为2~128个字符,以大小字母或中文开头,可包含数字、下划线(_)和短划线(-)。 | nametest |
TransitRouterAttachmentDescription | string | 否 | VPN连接的描述信息。 描述长度为2~256个字符,必须以字母或中文开头,但不能以 | desctest |
VpnId | string | 是 | IPsec连接ID。 | vco-p0w042cqwvlhl4zyw**** |
VpnOwnerId | long | 否 | IPsec连接所属的阿里云账号(主账号)ID。
| 1210123456123456 |
AutoPublishRouteEnabled | boolean | 否 | 是否允许转发路由器实例自动向IPsec连接发布路由条目。取值:
| true |
ChargeType | string | 否 | 计费方式。 仅取值:POSTPAY(默认值),表示按使用量付费。 | POSTPAY |
Zone | array | 是 | 当前地域下的可用区ID。 系统将在您指定的可用区下创建资源。 | |
object | 否 | 可用区ID。 | ||
ZoneId | string | 是 | 可用区ID。 您可以通过调用ListTransitRouterAvailableResource接口获取地域ID。 | ap-southeast-2a |
Tag | array | 否 | 标签信息列表。 一次最多支持输入20个标签信息。 | |
object | 否 | 标签信息。 | ||
Key | string | 否 | 资源的标签键。 一旦传入该值,则不允许为空字符串。最多支持64个字符,不能以 一次最多支持输入20个标签的标签键。 | TagKey |
Value | string | 否 | 资源的标签值。 标签值可以为空或输入不超过128个字符的字符串,不能以 每一个标签键对应一个标签值,一次最多支持输入20个标签键对应的标签值。 | TagValue |
返回参数
示例
正常返回示例
JSON
格式
{
"TransitRouterAttachmentId": "tr-attach-y5dup2qwfyh9lu****",
"RequestId": "8B5DD40A-3A29-5AC0-B8DA-05FD10D5C893"
}
错误码
HTTP status code | 错误码 | 错误信息 | 描述 |
---|---|---|---|
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. | 您没有权限创建服务关联角色,角色名:AliyunServiceRolePolicyForCEN,服务名:cen.aliyuncs.com。请确保已授予当前用户ram:CreateServiceLinkedRole权限。 |
400 | OperationUnsupported.TransitRouterRegionId | The specified TransitRouterRegion does not support the operation. | 中转地域不支持此操作。 |
400 | InvalidCenId.NotFound | CenId is not found. | CEN实例不存在。 |
400 | InvalidStatus.ResourceStatus | The resource is not in a valid state for the attachment operation. | 当前资源状态不支持该操作,请稍后重试。 |
400 | InvalidTransitRouterId.NotFound | TransitRouterId is not found. | 转发路由实例ID不存在。 |
400 | Forbbiden.TransitRouterServiceNotOpen | The user has not open transit router service. | 转发路由器服务未打开,请打开后重试。 |
400 | InvalidTransitRouterMode.NeedUpgrade | TransitRouter need to upgrade. | 当前转发路由器模式不支持。 |
400 | InvalidAvailable.NoResource | No resource in the available zone. | 当前可用区资源不足。 |
400 | OperationUnsupported.VpnAttachment | The specified region does not support the operation. | 当前地域不支持该操作。 |
400 | OperationUnsupported.TransitRouterType | The specified TransitRouterType does not support the operation. | 当前TransitRouter类型不支持该操作。 |
400 | OperationFailed.AllocateCidrFailed | Operation failed because vpn allocate cidr failed. | vpn申请cidr失败。 |
400 | OperationUnsupported.ZoneId | The specified ZoneId does not support the operation. | - |
400 | MissingParam.CenIdOrRegionId | Either CenId or RegionId must be specified. | CenId或者RegionId是必选参数。 |
400 | IllegalParam.RegionId | RegionId is illegal. | 参数中指定的Region不合法。 |
400 | OperationUnsupported.CenFullLevel | CEN full level does not support TransitRouter | Full类型CEN不支持创建企业版转发路由器。 |
400 | InvalidOperation.CenInstanceStatus | The CEN instance is not in a valid state for the operation. | - |
400 | IllegalParam.ZoneMappings | The Specified Parameter ZoneMappings is illegal | 参数中指定的ZoneMappings不合法。 |
400 | IncorrectStatus.TransitRouter | The status of TransitRouter is incorrect. | 当前TransitRouter的状态不支持该操作,请稍后重试。 |
400 | InvalidOperation.VpnNetworkTypeInvalid | The network type of child-instance is invalid. | 该实例的network type不合法。 |
400 | QuotaExceeded.CenQuotaVpnAttachPerTransitRouter | The maximum number of VPN attachment per Transit Router is exceeded. | 每个转发路由器支持创建的VPN连接个数超限,可提交工单提升额度。 |
400 | QuotaFull.ChildInstanceRelatedCen | The childinstance has exceed the quota of the times that a childinstance can be attached as an attachment. | 该实例绑定CEN数量已达到上限,无法加载。 |
400 | InvalidParameter | Invalid parameter. | 参数不合法。 |
400 | Unauthorized | The AccessKeyId is unauthorized. | 账号无权限操作。 |
访问错误中心查看更多错误码。
变更历史
变更时间 | 变更内容概要 | 操作 | ||||
---|---|---|---|---|---|---|
2023-01-04 | OpenAPI 错误码发生变更 | |||||
| ||||||
2022-12-22 | OpenAPI 错误码发生变更 | |||||
|