Hetzner.Network reference
Network
Section titled “Network”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.
Network: Creating a Network
Section titled “Network: Creating a Network”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" }, ],});Network: Routes and protection
Section titled “Network: Routes and protection”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,});Network: Labels
Section titled “Network: Labels”const network = yield* Hetzner.Network("vpc", { ipRange: "10.0.0.0/16", labels: { env: "prod", role: "vpc" },});Network: Looking up an existing network
Section titled “Network: Looking up an existing network”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],});