Validated on 27 Feb 2025 • Last edited on 28 Feb 2025
DigitalOcean Reserved IPs are publicly-accessible static IPv4 addresses. Assign and reassign reserved IP addresses to Droplets as needed, or implement an automated failover mechanism with reserved IPs to build a high availability infrastructure. IPv6 support is now available in public preview. Enroll in the feature preview to create reserved IPv6 addresses.
You can reassign a reserved IP to point it at a different Droplet. You can also unassign it from a Droplet entirely.
# Assign a Reserved IP to a Droplet
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
-d '{"type":"assign","droplet_id":8219222}' \
"https://api.digitalocean.com/v2/reserved_ips/45.55.96.47/actions"
# Unassign a Reserved IP
# curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
-d '{"type":"unassign"}' \
"https://api.digitalocean.com/v2/reserved_ips/45.55.96.47/actions"
Go
Using Godo, the official DigitalOcean V2 API client for Go:
import (
"context"
"os"
"github.com/digitalocean/godo"
)
func main() {
token := os.Getenv("DIGITALOCEAN_TOKEN")
client := godo.NewFromToken(token)
ctx := context.TODO()
// Assign a Reserved IP to a Droplet
action, _, err := client.ReservedIPActions.Assign(ctx, "45.55.96.47", 8219222)
// Unassign a Reserved IP
action, _, err := client.ReservedIPActions.Unassign(ctx, "45.55.96.47")
}
Ruby
Using DropletKit, the official DigitalOcean V2 API client for Ruby:
require 'droplet_kit'
token = ENV['DIGITALOCEAN_TOKEN']
client = DropletKit::Client.new(access_token: token)
# Assign a Reserved IP to a Droplet
client.reserved_ip_actions.assign(ip: '45.55.96.47', droplet_id: 8219222)
# Unassign a Reserved IP
# client.reserved_ip_actions.unassign(ip: '45.55.96.47')
Python
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
req={
"type": "unassign"
}
resp = client.reserved_ips_actions.post(reserved_ip="49.32.13.21", body=req)
To reassign a reserved IPv6 address (currently available in public preview) instead of IPv4, replace reserved-ip with reserved-ipv6 in the previous examples.
Reassign a Reserved IP Using the Control Panel
To reassign or unassign a reserved IP from the control panel, click Networking in the main menu, then click Reserved IPs.
This page lists your reserved IPs and their assigned Droplets. Open the More menu of the reserved IP you want to reassign or unassign:
From the More menu, click Unassign to unassign the reserved IP entirely, or click Reassign and pick a new Droplet in the Search for a Droplet text box that opens. You can only reassign reserved IPs to Droplets in the same datacenter.