How to Destroy a Droplet from the DigitalOcean Control Panel

DigitalOcean Droplets are Linux-based virtual machines (VMs) that run on top of virtualized hardware. Each Droplet you create is a new server you can use, either standalone or as part of a larger, cloud-based infrastructure.


Deleting a Droplet permanently and irreversibly destroys the Droplet and its contents, and its automated backups. Optionally, you can also destroy a Droplet and its associated snapshots, volumes, and volume snapshots. To save one or more of the backup images, convert the backup into a snapshot before deleting the Droplet.

Automate the Destruction of a Droplet

How to destroy a Droplet using the DigitalOcean CLI

To destroy a Droplet via the command-line, follow these steps:

  1. Install doctl, the DigitalOcean command-line tool.

  2. Create a personal access token, and save it for use with doctl.

  3. Use the token to grant doctl access to your DigitalOcean account.

                  doctl auth init
                
  4. Finally, destroy a Droplet with doctl compute droplet delete. The basic usage looks like this, but you'll want to read the usage docs for more details:

                  doctl compute droplet delete <droplet-id|droplet-name>... [flags]
                
How to destroy a Droplet using the DigitalOcean API

To destroy a Droplet using the DigitalOcean API, follow these steps:

  1. Create a personal access token, and save it for use with the API.

  2. Send a DELETE request to https://api.digitalocean.com/v2/droplets/{droplet_id}

    cURL

    To destroy a Droplet with cURL, call:

    
                    curl -X DELETE \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
      "https://api.digitalocean.com/v2/droplets/3164494"

    Go

    Go developers can use Godo, the official DigitalOcean V2 API client for Go. To destroy a Droplet with Godo, use the following code:

    
                    import (
        "context"
        "os"
    
        "github.com/digitalocean/godo"
    )
    
    func main() {
        token := os.Getenv("DIGITALOCEAN_TOKEN")
    
        client := godo.NewFromToken(token)
        ctx := context.TODO()
    
        _, err := client.Droplets.Delete(ctx, 3164494)
    }

    Ruby

    Ruby developers can use DropletKit, the official DigitalOcean V2 API client for Ruby. To destroy a Droplet with DropletKit, use the following code:

    
                    require 'droplet_kit'
    token = ENV['DIGITALOCEAN_TOKEN']
    client = DropletKit::Client.new(access_token: token)
    
    client.droplets.delete(id: 3164494)

Destroy a Droplet from the Control Panel

To destroy a Droplet from the control panel, open the Droplet’s More menu and click Destroy. Alternately, you can click the Droplet’s name to access its main page and select Destroy from the left menu.

Droplet more menu

On the Destroy page, there are two headings: Destroy Droplet and backups and Rebuild Droplet. Under Destroy Droplet and backups, you can choose to destroy the Droplet and its backups. If the Droplet has associated resources, you can also choose to delete some or all of them, but they are not destroyed by default.

If you wish to retain a backup, you must convert it to a snapshot before deleting it. Any associated reserved IP addresses, load balancers, or firewalls still need to be deleted individually.

Destroy Droplet Only

To destroy the Droplet itself and backups without destroying any of its associated resources, click Destroy this Droplet and backups.

Destroy Droplet Only

In the confirmation window, click Confirm to destroy the Droplet.

Automate the Destruction of a Droplet and its Associated Resources

How to destroy a Droplet and its associated resources using the DigitalOcean API

To destroy a Droplet and its associated resources using the DigitalOcean API, follow these steps:

  1. Create a personal access token, and save it for use with the API.

  2. Send a DELETE request to https://api.digitalocean.com/v2/droplets/{droplet_id}/destroy_with_associated_resources/dangerous

    cURL

    To destroy a Droplet and its associated resources with cURL, call:

    
                    curl -X DELETE -H "X-Dangerous: true" \
      -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
      "https://api.digitalocean.com/v2/droplets/187000742/destroy_with_associated_resources/dangerous"

Destroy Droplet and its Associated Resources in the Control Panel

To destroy a Droplet and any of its associated resources, click the Show associated resources checkbox.

Destroy Droplet and Resources

In their respective resource sections, select any of the Droplet’s associated snapshots, volumes, or volume snapshots you would like to destroy along with the Droplet. Once you’ve selected the resources to destroy, click Destroy this Droplet, backups, and X selected resources (“X” being the number of resources you’ve selected).

In the confirmation window, review the list of resources to be destroyed, then enter the Droplet’s name into the confirmation field and click Destroy. Your Droplet, any automated backups, and the selected resources will be permanently destroyed.

Confirm Destruction of Droplet and Resources

Remaining Resources

Any resources that you do not destroy will appear in their respective category in the control panel’s Manage section. Direct links are listed below in the order they appear in the menu.

Volumes

Images

Networking