Update a NAT Gateway Rule

Modify a NAT gateway rule by performing a PUT (full replacement) or PATCH (partial update) request.

Endpoint

https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/natgateways/{natGatewayId}/rules/{ruleId}

Request

Full update (PUT)

curl --location \
--request PUT 'https://api.ionos.com/cloudapi/v6/datacenters/15f67991-0f51-4efc-a8ad-ef1fb31a480c/natgateways/8b3a6e2d-c9f1-4d3e-a7b2-1e4f8c9d3a2b/rules/5d4c3b2a-1e9f-8d7c-6b5a-4f3e2d1c0b9a' \
--header 'Authorization: Bearer $IONOS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
  "properties": {
    "name": "Updated NAT Rule",
    "type": "SNAT",
    "protocol": "TCP",
    "sourceSubnet": "10.0.1.0/24",
    "publicIp": "203.0.113.15",
    "targetSubnet": "10.0.2.0/24",
    "targetPortRange": {
      "start": 8080,
      "end": 8090
    }
  }
}'

Partial update (PATCH)

The following table lists the request body parameters:

Body Parameters

Required

Type

Description

Example

properties.name

No

string

Specifies a human-readable name for the NAT rule.

Updated NAT Rule

properties.type

No

string

Defines the NAT rule type.

SNAT

properties.protocol

No

string

Sets the network protocol. Defaults to ALL.

TCP

properties.sourceSubnet

No

string

Specifies the source subnet in CIDR notation.

10.0.1.0/24

properties.publicIp

No

string

Defines the public IP address for the NAT rule.

203.0.113.15

properties.targetSubnet

No

string

Specifies the target or destination subnet in CIDR notation.

10.0.2.0/24

properties.targetPortRange

No

object

Defines the target port range of the NAT rule.

properties.targetPortRange.start

No

integer

Sets the inclusive start of the target port range.

8080

properties.targetPortRange.end

No

integer

Sets the inclusive end of the target port range.

8090

Response

A 202 Accepted response indicates that the NAT Gateway rule is successfully updated. The resource maintains a BUSY status until the update completes. The id and updated properties are provided in the response.

circle-info

Note: NAT Gateway rule updates are performed asynchronously. The response includes a Location header with a URL to poll the request status.

Last updated

Was this helpful?