You need to enable JavaScript to run this app.
文档中心
NAT网关

NAT网关

复制全文
下载 pdf
NAT网关
CreateNatGateway - 创建NAT网关
复制全文
下载 pdf
CreateNatGateway - 创建NAT网关
调用 CreateNatGateway 接口,创建一个NAT网关实例。​
使用说明​
  • 单个VPC可创建的NAT网关为3个。​
  • 单个NAT网关默认最多绑定10个公网IP,如果绑定公网IP的默认配额无法满足需要,请前往火山引擎配额中心提升相应配额。​
  • 标签的其他操作请参考TagResources、UntagResources、ListTagsForResources。​
调试​
API Explorer
您可以通过 API Explorer 在线发起调用,无需关注签名生成过程,快速获取调用结果。
​
请求参数​
下方仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数。​
Action string 必选 示例值:CreateNatGateway​
要执行的操作,取值:CreateNatGateway。​
​
Version string 必选 示例值:2020-04-01​
API的版本,取值:2020-04-01。​
​
BillingType integer 可选 示例值:1​
NAT网关的计费方式。取值如下:​
  • 1 :包年包月。​
  • 2(默认值):按量计费-按规格计费。​
  • 3:按量计费-按使用量计费。​
说明​
当NetworkType 传入intranet时,本参数仅支持且必须传入3。​
​
NatGatewayName string 可选 示例值:nat-01​
NAT网关的名称。​
  • 需要以字母、中文或数字开头,可包含点号(.)、下划线(_)和短划线(-)。​
  • 长度限制为1 ~ 128个字符。不填默认是NAT网关实例的ID。​
​
Description string 可选 示例值:This is a nat​
NAT网关的描述。​
  • 需要以字母、中文或数字开头。​
  • 可包含英文逗号(,)、点号(.)、下划线(_)、空格( )、等号(=)、短横线(-)、中文逗号(,)、中文句号(。)。​
  • 长度限制为1 ~ 255个字符。不填默认空字符串。​
​
Spec string 可选 示例值:Small​
NAT网关的规格。​
  • Small(默认):小型。​
  • Medium:中型。​
  • Large:大型。​
说明​
当BillingType 传入3时,不支持传入本参数。​
​
PeriodUnit string 可选 示例值:Month​
购买包年包月NAT网关时长的单位,默认Month。​
  • Month :月。​
  • Year :年。​
​
Period integer 可选 示例值:3​
购买包年包月NAT网关的时长,默认1。​
  • 当PeriodUnit传入Month,Period取值范围:1 ~ 9、12、24、36。​
  • 当PeriodUnit传入Year,Period取值范围:1 ~ 3。​
​
ClientToken string 可选 示例值:333456899ff****​
保证请求幂等性。由客户端自动生成一个参数值,确保不同请求间该参数值唯一,避免当调用API超时或服务器内部错误时,客户端多次重试导致重复性操作。取值:​
  • 仅支持ASCII字符,且不能超过64个字符。​
​
Tags.N.Key string[] 可选 示例值:key1​
NAT网关用户标签的标签键(Key)。​
  • 参数 - N - 参数:表示标签键(Key)的序号,取值范围:1~50,且N应按照连续的从小到大的顺序。​
  • 多个标签键(Key)之间用&分隔。 不能以volc:开头,包括任意大小写形式。​
  • 长度取值范围为1~128字符,允许输入各国语言文字、数字、空格( )、下划线(_)、点号(.)、半角冒号(:)、斜杠(/)、等号(=)、加号(+)、中划线(-)和@(@)。 若标签键开头或结尾存在空格,系统会自动为其去除。​
说明​
同一资源的标签键不允许重复。​
​
Tags.N.Value string[] 可选 示例值:value1​
NAT网关用户标签的标签值(Value)。​
  • 参数 - N - 参数:表示标签值(Value)的序号,取值范围:1~50,且N应按照连续的从小到大的顺序。​
  • 多个标签值(Value)之间用&分隔。​
  • 长度取值范围为0~256字符,不填默认为空。​
  • 允许输入各国语言文字、数字、空格( )、下划线(_)、点号(.)、半角冒号(:)、斜杠(/)、等号(=)、加号(+)、中划线(-)和@(@)。​
  • 大小写敏感。​
  • 若标签值(Value)开头或结尾存在空格,系统会自动为其去除。​
说明​
如果传入该参数,则必须先传入Tags.N.Key。​
​
NetworkType string 可选 示例值:internet​
NAT网关类型。取值如下:​
  • internet(默认):公网NAT网关。​
  • intranet:私网NAT网关。​
​
DirectMode boolean 可选 示例值:true​
NAT网关的直通模式,取值如下:​
  • true(默认):直通模式NAT网关。​
  • false:非直通NAT网关。​
​
ProjectName string 可选 示例值:Project_1​
NAT网关所属项目的名称。不填默认加入default项目​
​
VpcId string 必选 示例值:vpc-2feypfmenesqo59gp67yz****​
NAT网关所在私有网络的ID。​
​
SubnetId string 可选 示例值:subnet-2feypga30rgg059gp67ag****​
NAT网关所在子网的ID。​
  • 传入的子网,必须是VpcId传入的私有网络的子网。​
  • 子网内至少有一个可用的私网IP。系统自动生成的NAT网关网卡将占用该子网一个私网IP。​
  • 子网所在的可用区需要已部署NAT网关资源。您可调用DescribeSubnets查询私有网络下子网所在的可用区,同时您可以调用ListNatGatewayAvailableZones查询下当前地域下有NAT网关资源的可用区。子网所在可用区将作为NAT网关的主可用区,并自动关联备可用区。当主可用区发生故障时,NAT网关自动切换到备可用区。​
​
​
​
返回参数​
下方仅列出本接口特有的返回参数。更多信息请参见返回结构。​
RequestId string 示例值:2021062415303301022514515207C4****​
请求ID。​
​
NatGatewayId string 示例值:ngw-2feq5xhimd88w59gp686****​
NAT网关实例ID。​
​
​
​
请求示例​
​
GET /?Action=CreateNatGateway&Version=2020-04-01&VpcId=vpc-2feypfmenesqo59gp67yz****&SubnetId=subnet-2feypga30rgg059gp67ag****&Spec=Small HTTP/1.1​
Host: natgateway.cn-beijing.volcengineapi.com​
Service: natgateway​
Region: cn-beijing​
​
返回示例​
​
{​
"ResponseMetadata": {​
"RequestId": "2021062415303301022514515207C4****",​
"Action": "CreateNatGateway",​
"Version": "2020-04-01",​
"Service": "natgateway",​
"Region": "cn-beijing"​
},​
"Result":{​
"RequestId": "2021062415303301022514515207C4****",​
"NatGatewayId": "ngw-2feq5xhimd88w59gp686****"​
}​
}​
​
错误码​
下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。​
​
状态码​
错误码​
错误信息​
说明​
400​
MissingParameter​
The request is missing a required parameter.​
该请求缺少必要参数。​
400​
InvalidParameter​
A parameter specified in the request is not valid, is unsupported or cannot be used.​
该请求传入了非法或不支持的参数。​
400​
InsufficientIpInSubnet​
The specified subnet does not contain enough free private IP addresses to fulfill your request.​
指定子网下可用IP不足。​
400​
UnsupportedOperation​
The request on the specified instance is denied due to the account in arrears status.​
因账户处于欠费状态,对于该实例的操作请求被拒绝。​
400​
QuotaExceeded.SecurityGroup​
Security group number exceeded quota.​
已达到当前账户在一个地域可创建安全组数量上限。​
400​
QuotaExceeded.RouteEntry​
Route entry of a route table number exceeded quota.​
已达到一个路由表可创建路由条目的上限。​
400​
QuotaExceeded.NatGateway​
NAT gateways number of the VPC exceeded quota.​
已达到一个VPC可创建的NAT网关的数量上限。​
400​
QuotaExceeded.Eni​
ENI number exceeded quota.​
已达到当前账户在一个地域可创建网卡数量上限。​
400​
OrderError​
Failed to create an order in one step.​
创建订单并支付失败。​
400​
LimitExceeded.Tags​
You've reached the limit on the number of tags that you can operate at one time.​
已达到单次可操作标签数量的上限。​
400​
InvalidZone.NotSupported​
The specified Availability Zone does not support Nat Gateways.​
指定子网所在可用区未部署NAT网关资源。​
400​
InvalidYearPeriod.Malformed​
The specified yearly period is malformed. Yearly period only supports 1~3.​
指定的包年包月按年购买时长不合法。包年包月按年购买时长只支持1~3年。​
400​
InvalidTagValue.Malformed​
The specified parameter tag value is invalid.​
标签值不合法。​
400​
InvalidTag.Disorder​
The specified index order of tag is malformed.​
指定标签的索引顺序参数格式不合法。​
400​
IdempotentParameterMismatch​
Arguments on this idempotent request are inconsistent with arguments used in previous request(s).​
此幂等请求的参数与前一个请求中使用的参数不一致。​
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​
InvalidNatGateway.NoSubnetInVpc​
The specified VPC has no subnet. NAT gateway cannot be created.​
指定的VPC没有子网,无法创建NAT网关。​
400​
InvalidNatGatewayDefaultRoute.Conflict​
A default route already exists in specified VPC, NAT gateway cannot be created.​
指定的VPC里已经存在默认路由,无法创建NAT网关。​
400​
InvalidNatGatewaySpec.Malformed​
The specified NAT spec is malformed.​
指定的NAT网关规格不支持。​
400​
InvalidParameter.ClientTokenMalformed​
The specified parameter ClientToken is malformed.​
指定的参数ClientToken格式不合法。参数长度不能超过64个ASCII字符。​
400​
InvalidPeriodUnit.Malformed​
The specified period unit is malformed. Pre billing period unit can only be Month or Year.​
指定的包年包月类型时长单位不合法。包年包月类型时长单位只能为月或年。​
400​
InvalidSubnet.VpcMismatch​
The specified subnet is not in the specified VPC.​
指定的子网不在指定的VPC中。​
400​
InvalidTagKey.Malformed​
The specified parameter tag key is invalid.​
标签键不合法。​
400​
InvalidNatGateway.PreOrder​
Create preorder for nat gateway failed.​
创建NAT网关的配置单失败。​
400​
InvalidNatGatewayNetworkType.Malformed​
The specified network type of NAT gateway is malformed.​
指定的NAT网关网络类型不合法。​
400​
QuotaExceeded.NatIp​
NAT IPs number of the cidr exceeded quota.​
已达到一个cidr可创建的NAT中转IP的数量上限。​
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.​
指定的描述格式不合法。请修复描述格式后重试。​
400​
InvalidDescription.Malformed​
The specified description is malformed.Ensure the maximum length of description is 255.​
指定的描述格式不合法。描述长度不能超过255个字符。​
400​
InvalidNatGateway.IPv4GatewayAttached​
The specified VPC has been attached to IPv4 gateway, direct mode NAT gateway cannot be created.​
指定的VPC已关联IPv4网关,无法创建直通模式的NAT网关。​
400​
InvalidNatGateway.UnSupportLocalZone​
The current type of NAT instance is not supported in local zones.​
本地区域不支持当前类型的 NAT 实例。​
400​
InvalidNatGateway.NoSubnetInRegion​
The specified region has no available subnet. NAT gateway cannot be created.​
指定的地域无可用子网​
400​
InvalidSubnet.IPv4Disabled​
IPv4 has been disabled for the specified subnet.​
指定子网已经禁用IPv4。​
403​
Forbidden​
You are not authorized to create or update an extra large NAT gateway.​
无权限创建或修改超大型NAT网关。​
404​
InvalidSubnet.NotFound​
The specified subnet does not exist.​
指定的子网不存在。​
404​
InvalidProject.NotFound​
The specified project does not exist.​
指定的项目不存在。​
404​
InvalidVpc.NotFound​
The specified VPC does not exist.​
指定的VPC不存在。​
412​
IdempotentProcessing​
The request uses the same client token as a previous one that is still in process.​
幂等请求处理中。​
412​
InvalidNatGateway.CreateEniFailed​
The specified nat gateway create eni failed.​
NAT网关创建ENI失败。​
500​
InternalError​
An internal error has occurred.​
发生内部错误。​
​
​
最近更新时间:2026.01.23 08:18:23
这个页面对您有帮助吗?
有用
有用
无用
无用