You need to enable JavaScript to run this app.
文档中心
VPN连接

VPN连接

复制全文
下载 pdf
VPN网关
CreateVpnGateway-创建VPN网关
复制全文
下载 pdf
CreateVpnGateway-创建VPN网关
调用CreateVpnGateway创建一个VPN网关。​
调试​
API Explorer
您可以通过 API Explorer 在线发起调用,无需关注签名生成过程,快速获取调用结果。
​
请求参数​
下方仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数。​
Action String 必选 示例值:CreateVpnGateway​
要执行的操作,取值:CreateVpnGateway。​
​
Version String 必选 示例值:2020-04-01​
API版本信息。​
​
VpcId String 必选 示例值:vpc-5fn4gia8n2t****​
VPN网关所在VPC的ID。您可调用DescribeVpcs查询VPC的ID信息。​
说明​
VPN连接暂不支持共享VPC,此处请不要传入共享VPC的ID。​
​
SubnetId String 必选 示例值:subnet-3thgqai7my4e8i****​
VPN网关使用子网的ID。您可调用DescribeSubnets查询子网的ID信息。​
​
Bandwidth Integer 必选 示例值:5​
VPN网关出云方向的带宽规格,单位:Mbps。取值:5、10、20、50、100、200、300、400、500、1000、3000。​
说明​
1000Mbps、3000Mbps带宽规格VPN网关为邀测功能,仅开通此规格的用户可使用,未开通此规格Bandwidth请避免传入。如有需要,请联系客户经理。​
​
VpnGatewayName String 可选 示例值:VpnGateway​
VPN网关的名称。​
  • 以中文、字母、数字开头,只能包含中文、字母、数字、点号(.)、下划线(_)和短划线(-)。​
  • 长度限制为1 ~ 128个字符。​
  • 不填默认为VPN网关的ID。​
​
Description String 可选 示例值:This is a sample description​
VPN网关的描述信息。​
  • 以中文、字母、数字开头,只能包含中文、字母、数字、点号(.)、空格( )、下划线(_)、中划线(-)、等号(=)、英文逗号(,)、中文逗号(,)、中文句号(。)。​
  • 长度限制为0 ~ 255个字符。​
  • 不填默认为空字符串。​
​
BillingType Integer 可选 示例值:1​
VPN网关的计费类型。默认“1”。​
  • 1(默认):包年包月。​
  • 2:按量计费(按固定配置)。​
​
PeriodUnit String 可选 示例值:Month​
包年包月类型VPN网关购买时长的单位,默认“Month”。​
  • Month:月​
  • Year:年​
​
Period Integer 可选 示例值:1​
包年包月类型VPN网关购买的时长,默认“1”。​
  • 当PeriodUnit传入值为Month,Period取值范围:1~9、12、24、36。​
  • 当PeriodUnit传入值为Year,Period取值范围:1~3。​
​
ProjectName String 可选 示例值:Project_1​
VPN网关所属的项目。不填默认为default,即创建的资源属于default项目。您可调用ListProjects查询当前账号下项目的信息。​
​
Tags.N.Key String 可选 示例值:key1​
VPN网关标签的标签键(Key)。​
  • 参数 - N:表示标签键的序号,取值范围:1~20。​
  • 多个标签键之间用&分隔。​
  • 命名规则如下:​
  • 不能以volc:或sys:的任意大小写组合开头。​
  • 只能包含语言字符、数字、空格和英文符号“_”、“.”、“:”、“/”、“=”、“+”、“-”、“@”。​
  • 长度限制在1~128个字符之间。​
说明​
同一资源的标签键不允许重复。​
​
Tags.N.Value String 可选 示例值:value1​
VPN网关标签的标签值(Value)。​
  • 参数 - N:表示标签值的序号,取值范围:1~20。​
  • 多个标签值之间用&分隔。​
  • 命名规则如下:​
  • 只能包含语言字符、数字、空格和英文符号“_”、“.”、“:”、“/”、“=”、“+”、“-”、“@”。​
  • 允许为空,长度限制在0~256个字符之间。​
  • 大小写敏感,不能以空格开头或结尾。​
说明​
传入Tags.N.Value则必须传入Tags.N.Key。​
​
ClientToken String 可选 示例值:123e4567-e89b-12d3-a456-42665544****​
客户端Token,用于保证请求幂等性。​
  • 由客户端自动生成一个参数值,确保不同请求间该参数值唯一,避免当调用API超时或服务器内部错误时,客户端多次重试导致重复性操作。​
  • 仅支持ASCII字符,且不能超过64个字符。​
  • 若不传入ClientToken,则此次API调用不进行幂等校验。​
​
IpsecEnabled Boolean 可选 示例值:true​
是否开启IPSec功能。​
  • true(默认值):开启​
  • false:关闭​
说明​
IpsecEnabled和SslEnabled不可同时传入false。​
​
DualTunnelEnabled Boolean 可选 示例值:true​
是否开启双隧道模式。​
  • true:开启​
  • false(默认值):关闭​
说明​
  • 双隧道模式正在邀测中,如需试用,请联系客户经理申请。​
  • DualTunnelEnabled和SslEnabled不可同时传入true。​
  • 已开通BGP功能时,该参数不可传入true。​
​
SecondarySubnetId String 可选 示例值:subnet-1b2f52ju7fojk17q7y1rk****​
VPN网关实例关联的第二个子网的ID。​
开启双隧道模式时,该参数为必填。​
​
SslMaxConnections Integer 可选 示例值:10​
SSL VPN规格的最大连接数,仅SslEnabled为true时可传入此参数。​
  • 5(默认值)​
  • 10​
  • 20​
  • 50​
  • 100​
  • 200​
​
Asn Integer 可选 示例值:64512​
VPN网关的ASN。​
  • 如需使用BGP功能,则此参数必须填写。​
  • VPN网关ASN的取值范围:64512~65534,4200000000~4294967294。​
​
SslEnabled Boolean 可选 示例值:false​
VPN网关是否开启SSL连接能力。取值如下:​
  • true:开启。​
  • false(默认值):关闭。​
说明​
DualTunnelEnabled和SslEnabled不可同时传入true。​
​
IpVersion String 可选 示例值:ipv4​
VPN网关的IP地址类型。取值如下:​
  • ipv4:IPv4地址类型。​
  • ipv6:IPv6地址类型。​
当DualTunnelEnabled传入false时,仅支持传入ipv4。​
​
IpStackType String 可选 示例值:ipv4_only​
VPN 网关的协议类型。取值如下:​
  • ipv4_only:IPv4协议类型。​
  • ipv6_only:IPv6协议类型。​
  • ipv4_ipv6:双栈协议类型。​
说明​
  • IpStackType传入的值需与IpVersion传入值类型保持一致,例如:IpVersion传入ipv4时,IpStackType支持传入ipv4_only和ipv4_ipv6。​
  • 当DualTunnelEnabled传入false时,不支持传入ipv6_only。​
​
​
返回参数​
下方仅列出本接口特有的返回参数。更多信息请参见返回结构。​
RequestId String 示例值:2022032111142501022524314704AF****​
请求ID。​
​
VpnGatewayId String 示例值:vgw-12bfa2du7fojk17q7y1rk****​
新创建VPN网关的ID。​
​
OrderId String 示例值:Order7078570823273845****​
新创建VPN网关的订单的ID。​
​
​
请求示例​
​
GET /?Action=CreateVpnGateway&Version=2020-04-01&VpnGatewayName=test&Description=test&VpcId=vpc-12bhs1ivo6p6o17q7y2x3****&SubnetId=subnet-2fewbgn7jbk0059gp67ap****&Bandwidth=5&BillingType=1&PeriodUnit=Month&Period=1 HTTP/1.1​
Host: vpn.cn-beijing.volcengineapi.com​
X-Date: 20251029T033538Z​
Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20251029/cn-beijing/vpn/request, SignedHeaders=host;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f​
​
返回示例​
​
{​
"ResponseMetadata":{​
"RequestId":"2022032111142501022524314704AF****",​
"Action":"CreateVpnGateway",​
"Version":"2020-04-01",​
"Service":"vpn",​
"Region":"cn-beijing"​
},​
"Result":{​
"RequestId":"2022032111142501022524314704AF****",​
"OrderId":"Order7078570823273845****",​
"VpnGatewayId":"vgw-12bfa2du7fojk17q7y1rk****"​
}​
}​
​
错误码​
下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。​
​
状态码​
错误码​
错误信息​
说明​
400​
InvalidName.Malformed​
The specified name is malformed.Ensure the maximum length of name is 128.​
指定的名称格式不合法。名称长度不能超过128个字符。​
400​
InvalidName.Malformed​
The specified name is malformed.​
指定的名称格式不合法。请修复名称格式后重试。​
400​
InvalidDescription.Malformed​
The specified description is malformed.Ensure the maximum length of description is 255.​
指定的描述格式不合法。描述长度不能超过255个字符。​
400​
InvalidDescription.Malformed​
The specified description is malformed.​
指定的描述格式不合法。请修复描述格式后重试。​
400​
InvalidSubnet.VpcMismatch​
The specified subnet is not in the specified VPC.​
指定的子网不在指定的VPC中。​
400​
InsufficientIpInSubnet​
The specified subnet does not contain enough free private IP addresses to fulfill your request.​
指定子网下可用IP不足。​
400​
InsufficientResource.VpnGatewayEip​
The specified region does not have enough EIP resources for VPN gateway.​
VPN网关可用EIP资源不足。​
400​
QuotaExceeded.Eni​
ENI number exceeded quota.​
已达到可创建网卡的数量上限。​
400​
QuotaExceeded.SecurityGroup​
Security group number exceeded quota.​
当前账户已达到在一个地域下最多可创建安全组数量上限。​
400​
InvalidVpnGatewayBandwidth.Malformed​
The specified VPN gateway bandwidth is malformed.​
指定的VPN网关带宽不支持。​
400​
InvalidBillingType.Malformed​
The specified billing type is malformed.​
指定的计费类型不合法。​
400​
InvalidMonthPeriod.Malformed​
The specified monthly period is malformed. Monthly period only supports 1~9, 12, 24, 36.​
指定的预付费按月购买时长不合法。预付费按月购买时长只支持1~9, 12, 24, 36月。​
400​
InvalidYearPeriod.Malformed​
The specified yearly period is malformed. Yearly period only supports 1~3.​
指定的预付费按年购买时长不合法。预付费按年购买时长只支持1~3年。​
400​
InvalidPeriodUnit.Malformed​
The specified period unit is malformed. Pre billing period unit can only be Month or Year.​
指定的预付费类型时长单位不合法。预付费类型时长单位只能为月或年。​
400​
OrderError​
Failed to create an order in one step.​
创建订单并支付失败。​
400​
PreOrderError​
Failed to create pre order.​
创建配置单失败。​
400​
QuotaExceeded.VPNGateway​
You've reached the limit on the number of VPN gateway per region that you can create.​
已达到当前账户在单一地域下可创建的VPN网关可创建数量上限。​
400​
QuotaExceeded.VPNGatewayEachVPC​
You've reached the limit on the number of VPN gateway per VPC that you can create.​
已达到当前账户在单一地域下可创建的VPN网关可创建数量上限。​
400​
InsufficientResource.VpnGateway​
The specified region does not have enough resources for VPN gateway.​
VPN网关可用资源不足。​
400​
InvalidTagKey.Malformed​
The specified parameter tag key is invalid.​
标签键不合法。​
400​
InvalidTagValue.Malformed​
The specified parameter tag value is invalid.​
标签值不合法。​
400​
LimitExceeded.Tags​
You've reached the limit on the number of tags that you can operate at one time.​
已达到单次可操作标签数量的上限。​
400​
InvalidTag.Disorder​
The specified index order of tag is malformed.​
指定标签的索引顺序参数格式不合法。​
400​
UnsupportedOperation​
The request on the specified instance is denied due to the account balance and available vouchers are less than 100 yuan in total.​
因账户余额及可用代金券共不足100元,对于该实例的操作请求被拒绝。​
400​
UnsupportedOperation​
The request on the specified instance is denied due to the account in arrears status.​
因账户处于欠费状态,对于该实例的操作请求被拒绝。​
400​
IdempotentParameterMismatch​
Arguments on this idempotent request are inconsistent with arguments used in previous request(s).​
此幂等请求的参数与前一个请求中使用的参数不一致。​
400​
InvalidParameter.ClientTokenMalformed​
The specified parameter ClientToken is malformed.​
指定的参数ClientToken格式不合法,长度不能超过64个ASCII字符。​
400​
InvalidSslMaxConnections.Malformed​
The specified SSL max connection of VPN Gateway is malformed.​
指定的VPN网关SSL最大连接数不合法。​
400​
InvalidVpnEnabled.Malformed​
IpsecEnabled and SslEnabled can not be set to false at the same time.​
IPSec功能与SSL功能不能同时关闭。​
400​
InvalidVpnGateway.InvalidASN​
The VPN Gateway ASN is invalid and it should be in the range of 64512-65534 or 4200000000-4294967294.​
指定的ASN不合法。ASN应该在64512-65534、4200000000-4294967294范围内。​
400​
InvalidSecondarySubnet.Conflict​
The specified second subnet conflicts with the first subnet.​
指定的第二个子网与第一个子网冲突。​
400​
InvalidSubnet.ZoneShouldDifferent​
The two subnets for creating a dual-tunnel VPN gateway must belong to different availability zones when creating it.​
指定的子网在同一个可用区。​
400​
InvalidVpnGateway.BGPSupport​
The dual-tunnel VPN gateway does not support BGP.​
双隧道类型的VPN网关不支持BGP功能。​
400​
InvalidVpnGateway.SslNotSupport​
The dual-tunnel VPN gateway does not support Ssl.​
双隧道类型的VPN网关不支持SSL功能。​
403​
Forbidden​
The specified service is temporarily unavailable. Please try again later.​
指定的服务暂时不可用,请稍后重试。​
403​
Forbidden.SharedVpc​
You are not authorized to perform operations on the specified shared VPC.​
无权限对指定共享私有网络进行操作。​
403​
Forbidden.DualTunnelVpnPermissionNotGranted​
This account has no permission to create a dual-tunnel VPN gateway.​
此账号无权限创建双隧道VPN网关。​
404​
InvalidSecondarySubnet.NotFound​
The specified secondary subnet does not exist.​
指定的第二个子网不存在。​
404​
InvalidProject.NotFound​
The specified Project does not exist.​
指定的项目不存在。​
404​
InvalidVpc.NotFound​
The specified VPC does not exist.​
指定的VPC不存在。​
404​
InvalidSubnet.NotFound​
The specified subnet does not exist.​
指定的子网不存在。​
404​
InvalidZoneId.NotFound​
The specified zone does not exist.​
指定的可用区不存在。​
412​
IdempotentProcessing​
The request uses the same client token as a previous one that is still in process.​
幂等请求处理中。​
​
最近更新时间:2026.07.10 15:37:21
这个页面对您有帮助吗?
有用
有用
无用
无用