Deleting a reserved IP unassigns it and permanently removes it from your account.
Delete an Assigned IP Using Automation
How to Delete a Reserved IPv4 Using the DigitalOcean CLI
- Install
doctl
, the official DigitalOcean CLI.
- Create a personal access token and save it for use with
doctl
.
- Use the token to grant
doctl
access to your DigitalOcean account.
- Finally, run
doctl compute reserved-ip delete
. Basic usage looks like this, but you can read the usage docs for more details:
doctl compute reserved-ip delete <reserved-ip> [flags]
The following example deletes the reserved IP address 203.0.113.25
:
doctl compute reserved-ip delete 203.0.113.25
How to Delete a Reserved IPv4 Using the DigitalOcean API
- Create a personal access token and save it for use with the API.
- Send a DELETE request to
https://api.digitalocean.com/v2/reserved_ips/{reserved_ip}
.
cURL
Using cURL:
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
"https://api.digitalocean.com/v2/reserved_ips/45.55.96.47"
Go
Using Godo, the official DigitalOcean 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()
_, err := client.ReservedIPs.Delete(ctx, "45.55.96.34")
}
Ruby
Using DropletKit, the official DigitalOcean API client for Ruby:
require 'droplet_kit'
token = ENV['DIGITALOCEAN_TOKEN']
client = DropletKit::Client.new(access_token: token)
client.reserved_ips.delete(ip: '45.55.96.47')
Python
Using PyDo, the official DigitalOcean API client for Python:
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
resp = client.reserved_ips.delete(reserved_ip="45.55.96.47")
How to Delete a Reserved IPv6 Using the DigitalOcean CLI
- Install
doctl
, the official DigitalOcean CLI.
- Create a personal access token and save it for use with
doctl
.
- Use the token to grant
doctl
access to your DigitalOcean account.
- Finally, run
doctl compute reserved-ipv6 delete
. Basic usage looks like this, but you can read the usage docs for more details:
doctl compute reserved-ipv6 delete <reserved-ipv6> [flags]
The following example deletes the reserved IPv6 address 5a11:a:b0a7
:
doctl compute reserved-ipv6 delete 5a11:a:b0a7
How to Delete a Reserved IPv6 Using the DigitalOcean API
- Create a personal access token and save it for use with the API.
- Send a DELETE request to
https://api.digitalocean.com/v2/reserved_ipv6/{reserved_ip}
.
Delete an Assigned IP Using the Control Panel
To delete a reserved IP from the control panel, click Networking in the main menu, then click the Reserved IPs tab. Open the More menu of the reserved IP you want to delete, then click Delete.
In the confirmation window, click Delete Reserved IP to perform the deletion.