Overview

Date: 2026-05-11

Time: 15:36

Overview

A standalone teardown script that destroys a Linode cloud instance by looking up its label from a local state file and issuing a DELETE against the Linode API. It cleans up the state file afterward. This is the counterpart to a provisioning script that creates instances and writes state.json.

Usage Patterns


# Destroy using default state.json in current directory
LINODE_TOKEN=xxx ./destroy_linode.py

# Destroy using a custom state file
LINODE_TOKEN=xxx ./destroy_linode.py my-server-state.json

Runs as a uv run script — uv resolves the httpx dependency automatically, no venv setup needed.

API and Configuration

| Input | Type | Description |

|-------|------|-------------|

| argv[1] | CLI arg (optional) | Path to state file. Defaults to state.json |

| LINODE_TOKEN | Env var (required) | Linode API personal access token |

State file format — expects JSON with a resources dict where each value has a "label" key:


{"resources": {"my_server": {"label": "my-linode-label"}}}

Key Behaviors

Relationships