FloatingIpAssignment
Source:
src/Hetzner/FloatingIpAssignment.ts
Assigns a Hetzner Cloud FloatingIp to a Server. The assignment
is existence-only: observe the Floating IP and ensure it is bound to
the Server. Changing either reference updates in place (the previous
IP is unassigned, then the new pair is assigned).
A Floating IP can be assigned to at most one Server at a time. A Server may hold many Floating IPs. Destroying the assignment unassigns the IP but leaves both the Floating IP and the Server in place.
Assigning a Floating IP
Section titled “Assigning a Floating IP”Assign an IPv4 to a Server
const server = yield* Hetzner.Server("web", { image: "ubuntu-24.04", serverType: "cx23", location: "nbg1",});const ip = yield* Hetzner.FloatingIp("public-ip", { type: "ipv4", homeLocation: "nbg1",});const assignment = yield* Hetzner.FloatingIpAssignment("public-ip-web", { floatingIp: ip, server,});Assign with stub identities
const assignment = yield* Hetzner.FloatingIpAssignment("public-ip-web", { floatingIp: { id: 123 }, server: { serverId: 42 },});