CLI Companion

  • Hugging Face CLI
    • login
    • whoami
    • repo create
    • upload
    • download
    • lfs-enable-largefiles
    • scan-cache
    • delete-cache
  • Hapi CLI
    • new
    • start
    • build
    • test
    • plugin create
    • route add
  • Cloudflared
    • tunnel
    • tunnel run
    • tunnel list
    • tunnel delete
    • access
    • access tcp
    • update

    The `cloudflared tunnel delete` command is used to remove an existing Cloudflare Tunnel. When you delete a tunnel, it stops routing traffic and its associated DNS records (if created by `cloudflared tunnel run` with `--dns` or `cloudflared tunnel route dns`) might become invalid or require manual cleanup.You can delete a tunnel by its name or its UUID. It's generally safer and more precise to use the UUID, especially if tunnel names are not unique across your account, though `cloudflared` usually warns or prompts for clarification in such cases.Once deleted, the tunnel can no longer be started or used.

    Syntax

    `cloudflared tunnel delete <TUNNEL_NAME_OR_UUID> [flags]`

    Arguments

    * `<TUNNEL_NAME_OR_UUID>`: This is a required argument. It can be either the unique name of the tunnel (e.g., `my-website-tunnel`) or its UUID (e.g., `a1b2c3d4-e5f6-7890-1234-567890abcdef`).

    Flags

    * `--force`, `-f`: (Optional) Forces the deletion of the tunnel without requiring a confirmation prompt. Use with caution, as this can lead to accidental deletions.

    * `--help`, `-h`: (Optional) Shows help message for the `delete` command.

    Usage Examples

    1. **Delete a tunnel by its name (with confirmation prompt):**

    This is the most common way to delete a tunnel. `cloudflared` will ask for confirmation before proceeding.

    bash
    cloudflared tunnel delete my-web-tunnel

    *Expected Output (example):*

    Are you sure you want to delete tunnel my-web-tunnel (a1b2c3d4-e5f6-7890-1234-567890abcdef)? [y/N]: y
        Tunnel my-web-tunnel a1b2c3d4-e5f6-7890-1234-567890abcdef deleted successfully.

    2. **Delete a tunnel by its UUID (with confirmation prompt):**

    Using the UUID ensures you are deleting the exact tunnel you intend, even if there might be multiple tunnels with similar names.

    bash
    cloudflared tunnel delete a1b2c3d4-e5f6-7890-1234-567890abcdef

    *Expected Output (example):*

    Are you sure you want to delete tunnel my-web-tunnel (a1b2c3d4-e5f6-7890-1234-567890abcdef)? [y/N]: y
        Tunnel my-web-tunnel a1b2c3d4-e5f6-7890-1234-567890abcdef deleted successfully.

    3. **Force delete a tunnel by name (no confirmation):**

    This is useful for scripting or automated environments where interactive prompts are not desirable. Be very careful when using `--force`.

    bash
    cloudflared tunnel delete my-web-tunnel --force

    *Expected Output (example):*

    Tunnel my-web-tunnel a1b2c3d4-e5f6-7890-1234-567890abcdef deleted successfully.

    Important Notes

    * **Associated Resources:** Deleting a tunnel *does not automatically remove* associated DNS records created via `cloudflared tunnel route dns` or `--dns` during `cloudflared tunnel run`. You might need to manually remove these DNS records from your Cloudflare DNS dashboard or using `cloudflared tunnel route dns delete`. Similarly, any ingress rules defined in the tunnel's configuration file (e.g., `config.yml`) are no longer active, but the file itself remains on your system.

    * **Tunnel Credentials:** The credentials file for the tunnel (e.g., `~/.cloudflared/<UUID>.json`) will **not** be automatically deleted from your local system when you delete the tunnel via `cloudflared tunnel delete`. You should manually remove this file if you no longer need it, especially if you are concerned about sensitive information.

    * **Cloudflare Account:** The `cloudflared tunnel delete` command interacts with your Cloudflare account to remove the tunnel entry. You must be authenticated to your Cloudflare account with sufficient permissions to manage tunnels.

    * **Listing Tunnels:** Before deleting, you can list your existing tunnels to confirm the exact name or UUID using `cloudflared tunnel list`.