All Products
Search
Document Center

NAT Gateway:CreateNatIpCidr

Last Updated:Nov 14, 2024

Creates a NAT CIDR block.

Operation description

Description

You cannot repeatedly call the CreateNatIpCidr operation to create a NAT CIDR block within the specified 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

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the NAT gateway with which you want to associate the CIDR block.

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

eu-central-1
NatGatewayIdstringYes

The ID of the Virtual Private Cloud (VPC) NAT gateway with which you want to associate the CIDR block.

ngw-gw8v16wgvtq26vh59****
NatIpCidrNamestringYes

The name of the CIDR block.

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

newcidr
NatIpCidrDescriptionstringYes

The description of the NAT CIDR block.

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

mycidr
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 NAT CIDR block that you want to associate with the NAT gateway.

The new CIDR block must meet the following conditions:

  • The NAT CIDR block must fall within 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, or their subnets.
  • The subnet mask must be 16 to 32 bits in length.
  • The NAT CIDR block cannot overlap with the private CIDR block of the VPC to which the NAT gateway belongs. If you want to use other IP addresses from the private CIDR block of the VPC to provide NAT services, create a vSwitch and attach the vSwitch to another VPC NAT gateway.
  • If you want to use public IP addresses to provide NAT services, make sure that the public IP addresses fall within a customer CIDR block of the VPC to which the VPC NAT gateway belongs. For more information, see What is customer CIDR block?.
172.16.0.0/24

Response parameters

ParameterTypeDescriptionExample
object
NatIpCidrIdstring

The ID of the NAT CIDR block.

vpcnatcidr-gw8lhqtvdn4qnea****
RequestIdstring

The request ID.

7021BEB1-210F-48A9-AB82-BE9A9110BB89

Examples

Sample success responses

JSONformat

{
  "NatIpCidrId": "vpcnatcidr-gw8lhqtvdn4qnea****",
  "RequestId": "7021BEB1-210F-48A9-AB82-BE9A9110BB89"
}

Error codes

HTTP status codeError codeError messageDescription
400IncorrectStatus.NatGatewayThe status of %s [%s] is incorrect.-
400OperationFailed.NatIpCidrInUseThe operation is failed because of %s.-
400QuotaExceeded.NatIpCidrThe quota of %s is exceeded, usage %s/%s.-
400OperationFailed.CreateNatIpCidrInVpcCidrBlockThe operation is failed because of Creating NatIpCidr in Vpc Cidr.-
400OperationFailed.CreateNatIpCidrNotInUserCidrThe operation is failed because of Creating NatIpCidr not in UserCidr.The operation failed because the NAT CIDR block does not fall within the user CIDR block.
400ResourceAlreadyExist.NatIpCidrThe specified resource of %s is already exist.-
404InvalidRegionId.NotFoundThe specified RegionId does not exist in our records.The specified region ID does not exist.
404ResourceNotFound.NatGatewayThe specified resource of %s is not found.-
404ResourceNotFound.VPCThe specified resource of %s is not found.-

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

Change history

Change timeSummary of changesOperation
2024-10-23The Error code has changedView Change Details
2024-07-23API Description Update. The Error code has changedView Change Details
2023-03-01The Error code has changedView Change Details