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
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | 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 |
NatGatewayId | string | Yes | The ID of the Virtual Private Cloud (VPC) NAT gateway for which you want to create the NAT IP address. | ngw-gw8v16wgvtq26vh59**** |
NatIpName | string | Yes | 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 | newnatip |
NatIpDescription | string | Yes | 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 | test |
DryRun | boolean | No | Specifies whether to perform only a dry run, without performing the actual request. Valid values:
| false |
ClientToken | string | No | 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 |
NatIpCidr | string | Yes | The CIDR block to which the NAT IP address belongs. | 192.168.0.0/24 |
NatIp | string | No | 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 |
Response parameters
Examples
Sample success responses
JSON
format
{
"NatIp": "192.168.0.34",
"RequestId": "E9AD97A0-5338-43F8-8A80-5E274CCBA11B",
"NatIpId": "vpcnatip-gw8y7q3cpk3fggs8****"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | Mismatch.NatIpAndNatIpCidr | The %s and %s are mismatched. | The specified %s and %s do not match. |
400 | ResourceNotFound.NatGateway | The specified resource of %s is not found. | - |
400 | ResourceNotFound.NatIpCidr | The specified resource of %s is not found. | The specified %s resource does not exist. |
400 | IncorrectStatus.NatGateway | %The status of %s [%s] is incorrect. | The NAT gateway is in an invalid state. |
400 | QuotaExceeded.NatIp | The quota of %s is exceeded, usage %s/%s. | - |
400 | ResourceAlreadyExist.NatIp | The specified resource of %s is already exist. | - |
400 | ResourceNotEnough.SwitchAvailableIps | The available private Ip number is not enough in your subnet. | The number of private IP addresses in the subnet is insufficient. |
400 | ResourceNotEnough.NatIp | The specified resource of NatIp is not enough. | Insufficient IP addresses in the specified CIDR block. |
404 | InvalidRegionId.NotFound | The 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 time | Summary of changes | Operation |
---|---|---|
2024-07-23 | API Description Update. The Error code has changed | View Change Details |
2023-07-03 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2023-06-09 | The Error code has changed | View Change Details |