Creates a NAT CIDR block.

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 CIDR block to be created belongs.

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

NatIpCidrName String Yes newcidr

The name of the NAT CIDR block.

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

NatIpCidrDescription String Yes mycidr

The description of the NAT CIDR block.

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

NatGatewayId String Yes ngw-gw8v16wgvtq26vh59****

The ID of the Virtual Private Cloud (VPC) NAT gateway where you want to create the NAT CIDR block.

DryRun Boolean No false

Specifies whether to precheck this request. Valid values:

  • true: sends the precheck request. The NAT CIDR block is not created. The system checks whether the AccessKey pair is valid, whether the RAM user is authorized, and whether the required parameters are specified. If the request fails the precheck, the corresponding error message is returned. If the request passes the precheck, the DryRunOperation error code is returned.
  • false: sends the API request. This is the default value. If the request passes the precheck, a 2XX HTTP status code is returned and the NAT CIDR block is created.
ClientToken String No 5A2CFF0E-5718-45B5-9D4D-70B3FF3898

The client token that is used to ensure the idempotency. You can use the client to generate the value, but you must make sure that it is unique among different requests. ClientToken can contain only ASCII characters. It cannot exceed 64 characters in length.

Note If you do not set this parameter, the system automatically uses the request ID as the client token. The ID of each request may be unique.
NatIpCidr String No 172.16.0.0/24

The NAT CIDR block to be created.

The CIDR block must meet the following conditions:

  • It must be 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, or one of their subnets.
  • The subnet mask must be 16 to 32 bits in lengths.
  • To use a public CIDR block as the NAT CIDR block, the VPC to which the VPC NAT gateway belongs must be authorized to use public CIDR blocks.

For more information, see Create a VPC NAT gateway.

Response parameters

Parameter Type Example Description
NatIpCidrId String vpcnatcidr-gw8lhqtvdn4qnea****

The ID of the NAT CIDR block.

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

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateNatIpCidr
&RegionId=eu-central-1
&NatIpCidrName=newcidr
&NatIpCidrDescription=mycidr
&NatGatewayId=ngw-gw8v16wgvtq26vh59****
&<Common request parameters>

Sample success responses

XML format

<CreateNatIpCidrResponse>
  <RequestId>7021BEB1-210F-48A9-AB82-BE9A9110BB89</RequestId>
  <NatIpCidrId>vpcnatcidr-gw8lhqtvdn4qnea****</NatIpCidrId>
</CreateNatIpCidrResponse>

JSON format

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

Error codes

HttpCode 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.