Hetzner Cloud icon

Hetzner Cloud

Manage servers, volumes, networks and more in Hetzner Cloud

Firewall → Create

AI-generated

Summary

Creates a new Hetzner Cloud firewall via POST /v1/firewalls with a name, optional rules array, and optional extra body fields, returning the API's create response.

Inputs

  • Name (required) — Unique name for the firewall (sent as body name).
  • Rules (JSON) — JSON array of firewall rules, e.g. [{"direction":"in","protocol":"tcp","port":"443","source_ips":["0.0.0.0/0","::/0"]}]. Defaults to []. Set as body rules; invalid JSON raises an error.
  • Additional Body Fields (JSON) — JSON object merged into the request body for fields not exposed in the UI (e.g. labels, apply_to). Explicitly set fields such as name and rules take precedence over keys with the same name. Invalid JSON raises an error.
  • Request Options — Node-level settings: batching (items per batch, interval), ignore SSL issues, proxy, and timeout (default 10000 ms).

Output shape

The raw JSON response from the Hetzner API for the create call, with no root-property unwrapping. This normally contains a firewall object (id, name, rules, labels, applied_to) and an actions array.

Unlike Get/Update, the response is not unwrapped, so the data sits under firewall and actions keys. Authentication uses the hetznerCloudApi credential. Errors from the API (e.g. duplicate name, invalid rules) are surfaced as node errors.

Examples

Example 1: Create a firewall allowing public HTTPS inbound

Name: web-firewall; Rules (JSON): [{"direction":"in","protocol":"tcp","port":"443","source_ips":["0.0.0.0/0","::/0"]}]

Example 2: Create a labeled firewall that auto-applies to servers by label

Name: prod-fw; Additional Body Fields: {"labels":{"env":"prod"},"apply_to":[{"type":"label_selector","label_selector":{"selector":"env=prod"}}]}

Links

Discussion