For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create a NAT Gateway

Creates a NAT Gateway within the data center.

This operation is restricted to contract owner, admin, and users with 'createInternetAccess' privileges.

post
Authorizations
AuthorizationstringRequired

You will need to base64 encode the string containing your credentials.

Note:

  • Basic Authentication is supported only when 2-Factor Authentication is not configured.
  • Users with 2-Factor Authentication activated must generate new 2FA-secured tokens in the DCD using [Token Manager](https://docs.ionos.com/cloud/set-up-ionos-cloud/management/identity-access-management/token-manager). These tokens do not inherit the 2FA-secured property by default.
  • Token deletion is only possible using the Token Manager.
Separate your username and password with a colon, i.e., username:password and send it as 'Authorization' request header. More details: https://en.wikipedia.org/wiki/Basic_access_authentication
Path parameters
datacenterIdstringRequired

The unique ID of the data center.

Query parameters
prettybooleanOptional

Controls whether the response is pretty-printed (with indentations and new lines).

Default: true
depthinteger · int32 · max: 10Optional

Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on

Default: 0
Header parameters
X-Contract-Numberinteger · int32Optional

Users with multiple contracts must provide the contract number, for which all API requests are to be executed.

Body
idstringRead-onlyOptional

The resource's unique identifier.

Example: 15f67991-0f51-4efc-a8ad-ef1fb31a480c
typestring · enumOptionalPossible values:
hrefstring · uriRead-onlyOptional

URL to the object representation (absolute path).

Example: <RESOURCE-URI>
Responses
202

Successful operation

application/json
post/datacenters/{datacenterId}/natgateways
POST /cloudapi/v6/datacenters/{datacenterId}/natgateways HTTP/1.1
Host: api.ionos.com
Authorization: Basic username:password
Content-Type: application/json
Accept: */*
Content-Length: 399

{
  "type": "natgateway",
  "metadata": {},
  "properties": {
    "name": "My NAT Gateway",
    "publicIps": [
      "81.173.1.2",
      "82.231.2.5",
      "92.221.2.4"
    ],
    "lans": [
      {
        "id": 3,
        "gatewayIps": [
          "10.12.1.2/24",
          "10.11.2.5/24",
          "10.11.2.4"
        ]
      }
    ],
    "tier": "ENHANCED_HA",
    "maintenanceWindow": {
      "dayOfTheWeek": "Monday",
      "time": "13:00:00"
    }
  },
  "entities": {
    "rules": {
      "type": "collection"
    },
    "flowlogs": {
      "type": "collection",
      "offset": 0,
      "limit": 1000,
      "_links": {}
    }
  }
}
{
  "id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
  "type": "natgateway",
  "href": "<RESOURCE-URI>",
  "metadata": {
    "etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
    "createdDate": "2015-12-04T14:34:09.809Z",
    "createdBy": "user@example.com",
    "createdByUserId": "user@example.com",
    "lastModifiedDate": "2015-12-04T14:34:09.809Z",
    "lastModifiedBy": "user@example.com",
    "lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
    "state": "AVAILABLE"
  },
  "properties": {
    "name": "My NAT Gateway",
    "publicIps": [
      "81.173.1.2",
      "82.231.2.5",
      "92.221.2.4"
    ],
    "lans": [
      {
        "id": 3,
        "gatewayIps": [
          "10.12.1.2/24",
          "10.11.2.5/24",
          "10.11.2.4"
        ]
      }
    ],
    "tier": "ENHANCED_HA",
    "maintenanceWindow": {
      "dayOfTheWeek": "Monday",
      "time": "13:00:00"
    }
  },
  "entities": {
    "rules": {
      "id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
      "type": "collection",
      "href": "<RESOURCE-URI>",
      "items": [
        {
          "id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
          "type": "natgateway-rule",
          "href": "<RESOURCE-URI>",
          "metadata": {
            "etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
            "createdDate": "2015-12-04T14:34:09.809Z",
            "createdBy": "user@example.com",
            "createdByUserId": "user@example.com",
            "lastModifiedDate": "2015-12-04T14:34:09.809Z",
            "lastModifiedBy": "user@example.com",
            "lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
            "state": "AVAILABLE"
          },
          "properties": {
            "name": "My NAT Gateway rule",
            "type": "SNAT",
            "protocol": "TCP",
            "sourceSubnet": "10.0.1.0/24",
            "publicIp": "192.18.7.17",
            "targetSubnet": "10.0.1.0/24",
            "targetPortRange": {
              "start": 10000,
              "end": 20000
            }
          }
        }
      ]
    },
    "flowlogs": {
      "id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
      "type": "collection",
      "href": "<RESOURCE-URI>",
      "items": [
        {
          "id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
          "type": "flow-log",
          "href": "<RESOURCE-URI>",
          "metadata": {
            "etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
            "createdDate": "2015-12-04T14:34:09.809Z",
            "createdBy": "user@example.com",
            "createdByUserId": "user@example.com",
            "lastModifiedDate": "2015-12-04T14:34:09.809Z",
            "lastModifiedBy": "user@example.com",
            "lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
            "state": "AVAILABLE"
          },
          "properties": {
            "name": "My resource",
            "action": "ACCEPTED",
            "direction": "INGRESS",
            "bucket": "bucketName/key"
          }
        }
      ],
      "offset": 0,
      "limit": 1000,
      "_links": {
        "prev": "<PREVIOUS-PAGE-URI>",
        "self": "<THIS-PAGE-URI>",
        "next": "<NEXT-PAGE-URI>"
      }
    }
  }
}

Last updated

Was this helpful?