Skip to content

Hetzner.Network reference

Source: packages/hetzner/src/Network.ts

A Hetzner Cloud private Network — an isolated IPv4 range that Cloud Servers and Load Balancers attach to. Subnets, routes, delete protection, and labels are synced on the Network itself; network_actions are not modeled as their own resources.

Basic Network

const network = yield* Hetzner.Network("vpc", {
ipRange: "10.0.0.0/16",
});

Network with a cloud subnet

const network = yield* Hetzner.Network("vpc", {
ipRange: "10.0.0.0/16",
subnets: [
{ type: "cloud", ipRange: "10.0.1.0/24", networkZone: "eu-central" },
],
});
const network = yield* Hetzner.Network("vpc", {
ipRange: "10.0.0.0/16",
subnets: [
{ type: "cloud", ipRange: "10.0.1.0/24", networkZone: "eu-central" },
],
routes: [{ destination: "10.10.0.0/24", gateway: "10.0.1.2" }],
deleteProtection: true,
});
const network = yield* Hetzner.Network("vpc", {
ipRange: "10.0.0.0/16",
labels: { env: "prod", role: "vpc" },
});

Network.lookup references a network Alchemy doesn’t manage (created in the Hetzner Console or by another stack). It is read during plan/deploy, never created, updated or deleted.

const network = Hetzner.Network.lookup({ name: "private" });
const server = yield* Hetzner.Server("Web", {
serverType: "cpx12",
image: "ubuntu-24.04",
location: "nbg1",
networks: [network],
});