# How to Destroy Firewalls DigitalOcean Cloud Firewalls are a network-based, stateful firewall service for Droplets provided at no additional cost. Cloud firewalls block all traffic that isn’t expressly permitted by a rule. ## Destroy a Firewall Using the CLI The destroy command requires the firewall’s ID to be destroyed. To retrieve a list of firewalls and their IDs, use the `doctl compute firewall list` command. ## How to Destroy a Firewall Using the DigitalOcean CLI 1. [Install `doctl`](https://docs.digitalocean.com/reference/doctl/how-to/install/index.html.md), the official DigitalOcean CLI. 2. [Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with `doctl`. 3. Use the token to grant `doctl` access to your DigitalOcean account. ```shell doctl auth init ``` 4. Finally, run `doctl compute firewall delete`. Basic usage looks like this, but you can [read the usage docs](https://docs.digitalocean.com/reference/doctl/reference/compute/firewall/delete/index.html.md) for more details: ```shell doctl compute firewall delete ... [flags] ``` The following example deletes a cloud firewall with the ID `f81d4fae-7dec-11d0-a765-00a0c91e6bf6`: ```shell doctl compute firewall delete f81d4fae-7dec-11d0-a765-00a0c91e6bf6 ``` ## Destroy a Firewall Using the API The destroy call requires the firewall’s ID to be destroyed. To retrieve a list of firewalls and their IDs, use the [`/v2/firewalls` firewalls endpoint](https://docs.digitalocean.com/reference/api/digitalocean/index.html.md#operation/firewalls_list). ## How to Destroy a Firewall Using the DigitalOcean API 1. [Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with the API. 2. Send a DELETE request to [`https://api.digitalocean.com/v2/firewalls/{firewall_id}`](https://docs.digitalocean.com/reference/api/digitalocean//index.html.md#operation/firewalls_delete). ### cURL Using cURL: ```shell curl -X DELETE \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ "https://api.digitalocean.com/v2/firewalls/bb4b2611-3d72-467b-8602-280330ecd65c" ``` ### Go Using [Godo](https://github.com/digitalocean/godo), the official DigitalOcean API client for Go: ```go import ( "context" "os" "github.com/digitalocean/godo" ) func main() { token := os.Getenv("DIGITALOCEAN_TOKEN") client := godo.NewFromToken(token) ctx := context.TODO() _, err := client.Firewalls.Delete(ctx, 'bb4b2611-3d72-467b-8602-280330ecd65c') } ``` ### Ruby Using [DropletKit](https://github.com/digitalocean/droplet_kit), the official DigitalOcean API client for Ruby: ```ruby require 'droplet_kit' token = ENV['DIGITALOCEAN_TOKEN'] client = DropletKit::Client.new(access_token: token) client.firewalls.delete(id: 'bb4b2611-3d72-467b-8602-280330ecd65c') ``` ### Python Using [PyDo](https://github.com/digitalocean/pydo), the official DigitalOcean API client for Python: ```python import os from pydo import Client client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) resp = client.firewalls.delete(firewall_id= "as9di9d") ``` ## Destroy a Firewall Using the Control Panel To destroy a firewall, from the **Networking** section of the [control panel](https://cloud.digitalocean.com), click the **Firewalls** tab. On the right of the firewall you want to destroy, click **More**, and then click **Destroy**. In the **Destroy Firewall** window that opens, click **Confirm** to destroy the firewall. Destroying a firewall does not destroy the Droplets that were associated with it.