Create a Managed NAT Gateway
The NAT Gateway service allows instances in a private subnet to connect to the Internet or other services but prevents inbound connections from the Internet. To create a NAT gateway, use a POST request to specify the data center, public IP addresses, and the LANs that will route through it.
Endpoint
https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/natgateways
Request
curl --location \
--request POST 'https://api.ionos.com/cloudapi/v6/datacenters/15f67991-0f51-4efc-a8ad-ef1fb31a480c/natgateways' \
--header 'Authorization: Bearer $IONOS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"properties": {
"name": "Production NAT Gateway",
"publicIps": [
"198.51.100.25"
],
"lans": [
{
"id": "2",
"gatewayIps": [
"192.168.1.5"
]
}
]
}
}'The following table lists the request body parameters:
Body Parameters
Required
Type
Description
Example
properties.name
yes
string
The name of the resource.
Production NAT Gateway
properties.publicIps
yes
array
A collection of public IP addresses. Use an IP address that you have reserved for this location.
["198.51.100.25"]
properties.lans
no
array
A collection of LANs connected to the NAT gateway. Include a valid subnet mask for each IP address. If you do not provide an IP address, the system generates an IP address with a /24 subnet.
See nested object below.
properties.lans[].id
yes
string
The ID of the LAN connected to the NAT gateway.
2
properties.lans[].gatewayIps
no
array
A collection of gateway IP addresses. The system auto-generates these if you do not provide them. These addresses must stay within the LAN's IP address range.
["192.168.1.5"]
Include the following mandatory fields in the request header to authenticate your requests:
Header Parameters
Required
Type
Description
Authorization
yes
string
Use a Bearer token to authenticate requests through a JSON Web Token (JWT).
Content-Type
yes
string
Set it to application/json.
Response
A 202 Accepted response indicates that the creation of the NAT Gateway has been initiated successfully. The response body contains the resource id and other deployment details.
Last updated
Was this helpful?