All Products
Search
Document Center

NAT Gateway:CreateNatIp

Last Updated:Jan 12, 2026
This topic is generated by a machine translation engine without any human intervention. ALIBABA CLOUD DOES NOT GUARANTEE THE ACCURACY OF MACHINE TRANSLATED CONTENT. To request a human-translated version of this topic or provide feedback on this translation, please include it in the feedback form.

Creates a NAT IP address.

Operation description

CreateNatIp is an asynchronous operation. After a request is sent, the system returns a request ID and runs the task in the background. You can call the ListNatIps operation to query the status of the task.

  • If a NAT IP address is in the Creating state, the NAT IP address is being created. In this case, you can only query the NAT IP address and cannot perform other operations.
  • If a NAT IP address is in the Available state, the NAT IP address is created.

You cannot repeatedly call the CreateNatIp operation to create a NAT IP address within a specific period of time.

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:
    • For mandatory resource types, indicate with a prefix of * .
    • 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
vpc:CreateNatIpcreate
*NatGateway
acs:vpc:{#regionId}:{#accountId}:natgateway/{#NatGatewayId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the NAT gateway to which the NAT IP address that you want to create belongs.

You can call the DescribeRegions operation to query the most recent list of regions.

eu-central-1
NatGatewayIdstringYes

The ID of the Virtual Private Cloud (VPC) NAT gateway for which you want to create the NAT IP address.

ngw-gw8v16wgvtq26vh59****
NatIpNamestringNo

The name of the NAT IP address.

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

newnatip
NatIpDescriptionstringNo

The description of the NAT IP address.

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

test
DryRunbooleanNo

Specifies whether to perform only a dry run, without performing the actual request. Valid values:

  • true: performs only a dry run. The system checks the request for potential issues, including missing parameter values, incorrect request syntax, and service 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 performs the actual request. If the request passes the dry run, a 2xx HTTP status code is returned and the operation is performed.
false
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 different requests. The client token can contain only ASCII characters.

Note If you do not specify this parameter, the system automatically uses the request ID as the client token. The request ID may be different for each request.
5A2CFF0E-5718-45B5-9D4D-70B3FF3898
NatIpCidrstringYes

The CIDR block to which the NAT IP address belongs.

192.168.0.0/24
NatIpstringNo

The NAT IP address that you want to create.

If you do not specify an IP address, the system randomly allocates an IP address from the specified CIDR block.

192.168.0.34
Ipv4PrefixstringNo

The created IP prefix address segment must be within the reserved network segment of the switch where the NAT is located, and the reserved network segment cannot be occupied. The IP prefix mask must be /28.

null
Ipv4PrefixCountlongNo

The number of automatically assigned IP prefixes. These are randomly allocated from the unassigned reserved segments of the switch where the NAT is located. Value range: 1 to 10.

1

Response parameters

ParameterTypeDescriptionExample
object

The created NAT IP address.

NatIpstring

The NAT IP address.

192.168.0.34
RequestIdstring

The request ID.

E9AD97A0-5338-43F8-8A80-5E274CCBA11B
NatIpIdstring

The ID of the NAT IP address.

vpcnatip-gw8y7q3cpk3fggs8****
Ipv4Prefixstring

The IPv4Prefix returned by the previous API is obsolete.

""
NatIpsarray<object>

The NatIp parameter that is returned after you create a NatIp. If you use IPv4Prefix to create a NatIp, the information about all NatIp is returned. We recommend that you use this parameter to obtain the information about a NatIp when you create a NatIp.

NatIpobject

The list of created NatIpLists is returned when Ipv4Preix is created.

NatIpstring

Returns the NatIp address of the created NatIpList list when Ipv4Preix is created.

192.168.2.128
NatIpIdstring

Returns the NatIpId of the created NatIpList list when Ipv4Preix is created.

vpcnatip-xxxxxxxx
Ipv4Prefixstring

The Ipv4Prefix of the created NatIpList list is returned when Ipv4Preix is created.

192.168.1.128/28

Examples

Sample success responses

JSONformat

{
  "NatIp": "192.168.0.34",
  "RequestId": "E9AD97A0-5338-43F8-8A80-5E274CCBA11B",
  "NatIpId": "vpcnatip-gw8y7q3cpk3fggs8****",
  "Ipv4Prefix": "",
  "NatIps": [
    {
      "NatIp": "192.168.2.128",
      "NatIpId": "vpcnatip-xxxxxxxx",
      "Ipv4Prefix": "192.168.1.128/28"
    }
  ]
}

Error codes

HTTP status codeError codeError messageDescription
400Mismatch.NatIpAndNatIpCidrThe %s and %s are mismatched.The specified %s and %s do not match.
400ResourceNotFound.NatGatewayThe specified resource of %s is not found.-
400ResourceNotFound.NatIpCidrThe specified resource of %s is not found.The specified %s resource does not exist.
400IncorrectStatus.NatGateway%The status of %s [%s] is incorrect.The NAT gateway is in an invalid state.
400QuotaExceeded.NatIpThe quota of %s is exceeded, usage %s/%s.NatIp and Ipv4Prefix quota use overflow.
400ResourceNotEnough.SwitchAvailableIpsThe available private Ip number is not enough in your subnet.The number of private IP addresses in the subnet is insufficient.
400ResourceNotEnough.NatIpThe specified resource of NatIp is not enough.Insufficient IP addresses in the specified CIDR block.
400ResourceAlreadyExist.NatIpThe specified resource of NatIp has already exist.Configured NatIp already exists
400Mismatch.Ipv4PrefixAndNatIpCidrThe %s and %s are mismatched.The Ipv4Prefix and NatIpCidr are mismatched.
400Mismatch.Ipv4PrefixAndCidrReservationsThe %s and %s are mismatched.The reserved network segments of the Ipv4Prefix and VSwitch do not match.
400ResourceAlreadyAssociated.Ipv4Prefix%s is already associated.Ipv4Prefix have been allocated.
400ResourceNotEnough.Ipv4PrefixThe resource of %s is not enough.Insufficient Ipv4Prefix resources.
400ResourceNotFound.Ipv4PrefixThe resource of s% is not found.The resource Ipv4Prefix does not exist.
400ResourceAlreadyAssociated.NatIpThe resource of %s was already associated.NatIp resources have been allocated.
400ResourceNotFound.NatIpThe specified resource of %s is not found.The specified NatIp parameter is not found.
400IllegalParam.Ipv4PrefixThe param of %s is illegal, must be /28 network segment.The parameter Ipv4Prefix is invalid and must be/28 network segment.
400ResourceAlreadyExist.Ipv4PrefixThe specified resource of %s is already exist.This Ipv4Prefix has already been created. Do not re-create it.
400QuotaExceeded.Ipv4PrefixThe quota of %s is exceeded, usage %s/%s.Ipv4Prefix quota usage overflow.
400OperationFailed.InstanceNotSupportnatgateway not support ipv4prefix.The gateway does not support Ipv4Prefix.
404InvalidRegionId.NotFoundThe specified RegionId does not exist in our records.The specified region ID does not exist.

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

Change history

Change timeSummary of changesOperation
2026-01-08The Error code has changedView Change Details
2025-11-03The Error code has changed. The response structure of the API has changedView Change Details
2024-12-30The Error code has changedView Change Details
2024-07-23API Description Update. The Error code has changedView Change Details
2023-07-03The Error code has changed. The request parameters of the API has changedView Change Details
2023-06-09The Error code has changedView Change Details