全部产品
Search
文档中心

专有网络 VPC:CreateIpv4Gateway - 创建IPv4网关

更新时间:Aug 28, 2026

调用CreateIpv4Gateway接口创建IPv4网关。

接口说明

  • CreateIpv4Gateway 接口属于异步接口,即系统返回一个实例 ID,但该 IPv4 网关尚未创建成功,系统后台的创建任务仍在进行。您可以调用 GetIpv4GatewayAttribute 查询 IPv4 网关的创建状态:
    • 当 IPv4 网关处于 Creating 状态时,表示 IPv4 网关正在创建中。

    • 当 IPv4 网关处于 Created 状态时,表示 IPv4 网关创建完成。

  • CreateIpv4Gateway 接口不支持在同一个 VPC 下并发创建 IPv4 网关。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

当前API暂无授权信息透出。

请求参数

名称

类型

必填

描述

示例值

Ipv4GatewayName

string

创建的 IPv4 网关的名称。

名称长度为 1~128 个字符,不能以http://https://开头。

ipv4

Ipv4GatewayDescription

string

创建的 IPv4 网关的描述信息。

描述长度为 1~256 个字符,不能以http://https://开头。

test

VpcId

string

创建的 IPv4 网关所在 VPC 的 ID。

一个 VPC 仅支持创建一个 IPv4 网关。

vpc-5tss06uvoyps5xoya****

DryRun

boolean

是否只预检此次请求。取值:

  • true:发送检查请求,不会创建 IPv4 网关。检查项包括是否填写了必需参数、请求格式、业务限制。如果检查不通过,则返回对应错误。如果检查通过,则返回错误码DryRunOperation

  • false(默认值):发送正常请求,通过检查后返回 HTTP 2xx 状态码并直接创建 IPv4 网关。

false

ClientToken

string

客户端 Token,用于保证请求的幂等性。

从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken 只支持 ASCII 字符。

说明

若您未指定,则系统自动使用 API 请求的 RequestId 作为 ClientToken 标识。每次 API 请求的 RequestId 不一样。

123e4567-e89b-12d3-a456-426655440000

RegionId

string

创建 IPv4 网关的地域 ID。

您可以通过调用 DescribeRegions 接口获取地域 ID。

ap-southeast-6

ResourceGroupId

string

资源组 ID。

rg-acfmxazb4ph6aiy****

Tag

array<object>

资源的标签。

object

标签。

Key

string

资源的标签键。最多支持输入 20 个标签键。如需传入该值,则不能输入空字符串。

一个标签键最多支持 128 个字符,不能以aliyunacs:开头,不能包含http://或者https://

FinanceDept

Value

string

资源的标签值。最多支持输入 20 个标签值。如需传入该值,可以输入空字符串。

最多支持 128 个字符,不能以aliyunacs:开头,不能包含http://或者https://

FinanceJoshua

RegionId

string

创建 IPv4 网关的地域 ID。

您可以通过调用 DescribeRegions 接口获取地域 ID。

ap-southeast-6

返回参数

名称

类型

描述

示例值

object

创建的 IPv4 网关的实例 ID。

Ipv4GatewayId

string

创建的 IPv4 网关的实例 ID。

ipv4gw-5tsnc6s4ogsedtp3k****

ResourceGroupId

string

资源组 ID。

rg-acfmxazb4ph6aiy****

RequestId

string

请求 ID。

F282742B-1BBB-5F63-A3AF-E92EC575A1A6

示例

正常返回示例

JSON格式

{
  "Ipv4GatewayId": "ipv4gw-5tsnc6s4ogsedtp3k****",
  "ResourceGroupId": "rg-acfmxazb4ph6aiy****",
  "RequestId": "F282742B-1BBB-5F63-A3AF-E92EC575A1A6"
}

错误码

HTTP status code

错误码

错误信息

描述

400 OperationDenied.ExistDirectEip The operation is not allowed because of existing direct eip. 不允许创建ipv4网关,因为存在直通eip
400 UnsupportedRegion The feature of ipv4Gateway is not supported in the region. 该地域不支持ipv4网关
400 Forbidden.OperateShareResource You cannot operate shared resources. 来自共享的资源不允许操作。
400 OperationDenied.SubnetRouteV1Exist The operation is not allowed because of existing subnetRouteV1. 操作不允许,该VPC下子网路由不符合规格
400 OperationDenied.NormalNatExist The operation is not allowed because of existing normalNat. 操作不允许,该VPC下存在普通型NAT网关
400 OperationDenied.VpcExistIpv4Gateway An IPv4 gateway already exists in the VPC. 不允许新建IPv4网关,因为VPC已经存在IPv4网关
400 UnsupportedFeature.Ipv4Gateway The feature of ipv4Gateway is not supported for [%s]. 创建ipv4网关失败,因为不支持ipv4网关特性
400 OperationDenied.VpnExist The operation is not allowed because of existing vpn. 不允许新建IPv4网关,因为VPC已经存在VPN网关
400 OperationDenied.DirectEipExist The operation is not allowed because of existing directEip. 操作不允许,该VPC下存在直通EIP或增强型NAT网关
400 OperationFailed.GetNfvServiceList The operation is failed because of get nfv serviceList failed. 操作不允许,获取nfv服务列表失败
400 IncorrectStatus.Vpc The status of %s [%s] is incorrect. 当前实例状态非稳态
400 OperationFailed.VpcNotExist The operation is failed because of vpc is not found. 操作失败,未找到vpc
400 IllegalParam.ResourceGroupId Invalid ResourceGroupld value. 指定的资源组非法或不存在

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情