Creates a NAT IP address.

Usage notes

CreateNatIp is an asynchronous operation. After you make a request, the ID of the request is returned but the NAT IP address is not created. The system creates the NAT IP address in the background. You can call the ListNatIps operation to query the status of a NAT IP address.

  • 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 but 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 the specified period of time.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
RegionId String Yes eu-central-1

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 region list.

NatGatewayId String Yes ngw-gw8v16wgvtq26vh59****

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

NatIpName String Yes newnatip

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. It cannot start with http:// or https://.

NatIpDescription String Yes test

The description of the NAT IP address.

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

DryRun Boolean No false

Specifies whether only to precheck this request. Valid values:

  • true: sends the precheck request but does not create the NAT IP address. The system checks your AccessKey pair, the Resource Access Management (RAM) user permissions, and the required parameters. If the request fails the precheck, an error message is returned. If the request passes the precheck, the DryRunOperation error code is returned.
  • false (default): sends the request. If the request passes the precheck, a 2xx HTTP status code is returned and the NAT IP address is created.
ClientToken String No 5A2CFF0E-5718-45B5-9D4D-70B3FF3898

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the value, but you must make sure that it is unique among different requests. The client token can contain only ASCII characters.

Note If you do not set this parameter, ClientToken is set to the value of RequestId. The value of RequestId for each API request may be different.
NatIpCidr String No 192.168.0.0/24

The CIDR block to which the NAT IP address belongs.

NatIpCidrId String No vpcnatip-gw8y7q3cpk3fggs87****

The ID of the CIDR block to which the NAT IP address belongs.

NatIp String No 192.168.0.34

The NAT IP address that you want to create.

If you do not specify an IP address, the system selects a random IP address from the specified CIDR block.

Action String Yes CreateNatIp

The operation that you want to perform. Set the value to CreateNatIp.

Response parameters

Parameter Type Example Description
NatIp String 192.168.0.34

The NAT IP address.

RequestId String E9AD97A0-5338-43F8-8A80-5E274CCBA11B

The ID of the request.

NatIpId String vpcnatip-gw8y7q3cpk3fggs8****

The ID of the NAT IP address.

Examples

Sample requests

http(s)://[Endpoint]/?RegionId=eu-central-1
&NatGatewayId=ngw-gw8v16wgvtq26vh59****
&NatIpName=newnatip
&NatIpDescription=test
&DryRun=false
&ClientToken=5A2CFF0E-5718-45B5-9D4D-70B3FF3898
&NatIpCidr=192.168.0.0/24
&NatIpCidrId=vpcnatip-gw8y7q3cpk3fggs87****
&NatIp=192.168.0.34
&Action=CreateNatIp
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateNatIpResponse>
    <NatIp>192.168.0.34</NatIp>
    <RequestId>E9AD97A0-5338-43F8-8A80-5E274CCBA11B</RequestId>
    <NatIpId>vpcnatip-gw8y7q3cpk3fggs8****</NatIpId>
</CreateNatIpResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "NatIp" : "192.168.0.34",
  "RequestId" : "E9AD97A0-5338-43F8-8A80-5E274CCBA11B",
  "NatIpId" : "vpcnatip-gw8y7q3cpk3fggs8****"
}

Error codes

HTTP status code Error code Error message Description
404 InvalidRegionId.NotFound The specified RegionId does not exist in our records. The error message returned because the specified region ID does not exist.

For a list of error codes, visit the API Error Center.