Skip to content

DigitalOcean.Reserved IPs reference

Source: packages/digitalocean/src/ReservedIp.ts

A DigitalOcean Reserved IP: a static public IPv4 address in one region that you can move between droplets. Point DNS at the reserved IP, and a droplet replacement keeps the address. Assign it with ReservedIpAssignment.

A reserved IP has no name or tags, so Alchemy knows it only by the address it recorded. An IP created by a deploy that crashed before saving state is not found again; delete it in the control panel. DigitalOcean bills a reserved IP that is not assigned to a droplet.

const host = yield* DigitalOcean.Droplet("app", {
region: "sfo3",
size: "s-1vcpu-1gb",
image: "ubuntu-24-04-x64",
});
const ip = yield* DigitalOcean.ReservedIp("app-ip", { region: "sfo3" });
yield* DigitalOcean.ReservedIpAssignment("app-ip-on-app", {
ip: ip.ip,
dropletId: host.dropletId,
});

Source: packages/digitalocean/src/ReservedIpAssignment.ts

Assigns a Reserved IP to a droplet. Changing dropletId moves the IP to the new droplet in one step, so traffic to the address switches without a gap. Destroying the assignment unassigns the IP; the IP stays reserved.

ReservedIpAssignment: Assigning a Reserved IP

Section titled “ReservedIpAssignment: Assigning a Reserved IP”
const ip = yield* DigitalOcean.ReservedIp("app-ip", { region: "sfo3" });
const host = yield* DigitalOcean.Droplet("app", {
region: "sfo3",
size: "s-1vcpu-1gb",
image: "ubuntu-24-04-x64",
replaceAfter: "30 days",
});
// A replaced droplet gets the address as soon as it is up.
yield* DigitalOcean.ReservedIpAssignment("app-ip-on-app", {
ip: ip.ip,
dropletId: host.dropletId,
});

Source: packages/digitalocean/src/ReservedIpv6.ts

A DigitalOcean Reserved IPv6: a static public IPv6 address in one region that you can move between droplets with ReservedIpv6Assignment. The droplets need ipv6: true.

A reserved IPv6 has no name or tags, so Alchemy knows it only by the address it recorded.

const host = yield* DigitalOcean.Droplet("app", {
region: "nyc3",
size: "s-1vcpu-1gb",
image: "ubuntu-24-04-x64",
ipv6: true,
});
const ip = yield* DigitalOcean.ReservedIpv6("app-ipv6", { region: "nyc3" });
yield* DigitalOcean.ReservedIpv6Assignment("app-ipv6-on-app", {
ip: ip.ip,
dropletId: host.dropletId,
});

Source: packages/digitalocean/src/ReservedIpv6Assignment.ts

Assigns a Reserved IPv6 to a droplet. Changing dropletId moves the address; destroying the assignment unassigns it.

ReservedIpv6Assignment: Assigning a Reserved IPv6

Section titled “ReservedIpv6Assignment: Assigning a Reserved IPv6”
const ip = yield* DigitalOcean.ReservedIpv6("app-ipv6", { region: "nyc3" });
const host = yield* DigitalOcean.Droplet("app", {
region: "nyc3",
size: "s-1vcpu-1gb",
image: "ubuntu-24-04-x64",
ipv6: true,
});
yield* DigitalOcean.ReservedIpv6Assignment("app-ipv6-on-app", {
ip: ip.ip,
dropletId: host.dropletId,
});