Creates a NAT IP address.

Instructions

CreateNatIp is an asynchronous operation. After a request is sent, the system returns a request 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

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

ParameterTypeRequiredExampleDescription
RegionIdStringYeseu-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.

NatGatewayIdStringYesngw-gw8v16wgvtq26vh59****

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

NatIpNameStringYesnewnatip

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 (-). The name must start with a letter and cannot start with http:// or https://.

NatIpDescriptionStringYestest

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://.

DryRunBooleanNofalse

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.
ClientTokenStringNo5A2CFF0E-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 token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters.

Note If you do not specify this parameter, the system uses the request ID as the client token. The request ID may be different for each request.
NatIpCidrStringNo192.168.0.0/24

The CIDR block to which the NAT IP address belongs.

NatIpCidrIdStringNovpcnatip-gw8y7q3cpk3fggs87****

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

NatIpStringNo192.168.0.34

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.

ActionStringYesCreateNatIp

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

Response parameters

ParameterTypeExampleDescription
NatIpString192.168.0.34

The NAT IP address that is created.

RequestIdStringE9AD97A0-5338-43F8-8A80-5E274CCBA11B

The request ID.

NatIpIdStringvpcnatip-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

HttpCodeError codeError messageDescription
400IncorrectStatus.NatGateway%The status of %s [%s] is incorrect.The NAT gateway is in an invalid state.
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.
404InvalidRegionId.NotFoundThe specified RegionId does not exist in our records.The specified region ID does not exist.

For a list of error codes, see Service error codes.