# ekristen/aws-nuke architecture

> Architecture diagram of the GitHub repository ekristen/aws-nuke, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ekristen/aws-nuke
- Repository: https://github.com/ekristen/aws-nuke

## Overview

aws-nuke is a command-line tool for removing resources from AWS accounts. Its main workflow is: select the run command, load configuration and credentials, identify the account and regions, select registered resource types, then let libnuke scan and remove matching resources, subject to filters and confirmation/dry-run settings. The repository also exposes account/config explanation and resource-listing commands; README-described global filters and all-enabled-region runs are included. Some orchestration and resource wiring is documented rather than fully visible in the sampled excerpts.

Main entry points: [`pkg/commands/nuke/nuke.go`](https://github.com/ekristen/aws-nuke/blob/main/pkg/commands/nuke/nuke.go) (Run command), [`main.go`](https://github.com/ekristen/aws-nuke/blob/main/main.go) (CLI entry), [`pkg/commands/account/account.go`](https://github.com/ekristen/aws-nuke/blob/main/pkg/commands/account/account.go) (Account explain), [`pkg/awsutil/session.go`](https://github.com/ekristen/aws-nuke/blob/main/pkg/awsutil/session.go) (Credentials and sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI commands"]
  node_entry["CLI entry<br/>[main.go]"]
  node_run["Run command<br/>[nuke.go]"]
  node_accountcmd["Account explain<br/>[account.go]"]
  node_configcmd["Config explain<br/>[config.go]"]
  node_listcmd["Resource list<br/>[list.go]"]
end

subgraph group_setup["Configuration and AWS"]
  node_config["Config loader<br/>[config.go]"]
  node_credentials["Credentials and sessions<br/>[session.go]"]
  node_account["Account discovery<br/>[account.go]"]
  node_regions["Region handling<br/>[region.go]"]
end

subgraph group_cleanup["Cleanup workflow"]
  node_prompt["Run confirmation<br/>[prompt.go]"]
  node_nukecli["Run orchestration<br/>[nuke.go]"]
  node_engine["Cleanup engine"]
  node_scanner["Resource scanning"]
  node_resourceops["Resource operations<br/>[resource.go]"]
end

subgraph group_catalog["AWS resources"]
  node_registry["Resource registry"]
  node_resourceimpl["AWS resource handlers"]
end

node_operator(("Operator"))
node_aws{{"AWS APIs"}}

node_operator -->|"invokes"| node_entry
node_entry -->|"registers command"| node_run
node_entry -->|"registers command"| node_accountcmd
node_entry -->|"registers command"| node_configcmd
node_entry -->|"registers command"| node_listcmd
node_run -->|"loads"| node_config
node_run -->|"configures credentials"| node_credentials
node_run -.->|"identifies account"| node_account
node_run -.->|"selects regions"| node_regions
node_run -->|"registers prompt"| node_prompt
node_run -->|"selects resource types"| node_registry
node_run -->|"starts run"| node_engine
node_engine -.->|"scans resources"| node_scanner
node_scanner -->|"uses regional options"| node_resourceops
node_registry -->|"registers handlers"| node_resourceimpl
node_resourceimpl -->|"lists and deletes"| node_aws
node_accountcmd -->|"loads"| node_config
node_accountcmd -->|"validates credentials"| node_credentials
node_accountcmd -->|"discovers account"| node_account
node_configcmd -->|"loads"| node_config
node_listcmd -->|"lists resource types"| node_registry
node_credentials -.->|"authenticates requests"| node_aws
node_account -.->|"queries account"| node_aws

click node_entry "https://github.com/ekristen/aws-nuke/blob/main/main.go"
click node_run "https://github.com/ekristen/aws-nuke/blob/main/pkg/commands/nuke/nuke.go"
click node_accountcmd "https://github.com/ekristen/aws-nuke/blob/main/pkg/commands/account/account.go"
click node_configcmd "https://github.com/ekristen/aws-nuke/blob/main/pkg/commands/config/config.go"
click node_listcmd "https://github.com/ekristen/aws-nuke/blob/main/pkg/commands/list/list.go"
click node_config "https://github.com/ekristen/aws-nuke/blob/main/pkg/config/config.go"
click node_credentials "https://github.com/ekristen/aws-nuke/blob/main/pkg/awsutil/session.go"
click node_account "https://github.com/ekristen/aws-nuke/blob/main/pkg/awsutil/account.go"
click node_regions "https://github.com/ekristen/aws-nuke/blob/main/pkg/nuke/region.go"
click node_prompt "https://github.com/ekristen/aws-nuke/blob/main/pkg/nuke/prompt.go"
click node_nukecli "https://github.com/ekristen/aws-nuke/blob/main/pkg/commands/nuke/nuke.go"
click node_resourceops "https://github.com/ekristen/aws-nuke/blob/main/pkg/nuke/resource.go"
click node_registry "https://github.com/ekristen/aws-nuke/tree/main/resources"
click node_resourceimpl "https://github.com/ekristen/aws-nuke/tree/main/resources"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_run,node_accountcmd,node_configcmd,node_listcmd toneBlue
class node_config,node_credentials,node_account,node_regions toneAmber
class node_prompt,node_nukecli,node_engine,node_scanner,node_resourceops,node_aws toneMint
class node_registry,node_resourceimpl toneRose
class node_operator toneIndigo
```

## Components

### CLI commands

- [CLI entry](https://github.com/ekristen/aws-nuke/blob/main/main.go): `main.go`
- [Run command](https://github.com/ekristen/aws-nuke/blob/main/pkg/commands/nuke/nuke.go): `pkg/commands/nuke/nuke.go`
- [Account explain](https://github.com/ekristen/aws-nuke/blob/main/pkg/commands/account/account.go): `pkg/commands/account/account.go`
- [Config explain](https://github.com/ekristen/aws-nuke/blob/main/pkg/commands/config/config.go): `pkg/commands/config/config.go`
- [Resource list](https://github.com/ekristen/aws-nuke/blob/main/pkg/commands/list/list.go): `pkg/commands/list/list.go`

### Configuration and AWS

- [Config loader](https://github.com/ekristen/aws-nuke/blob/main/pkg/config/config.go): `pkg/config/config.go`
- [Credentials and sessions](https://github.com/ekristen/aws-nuke/blob/main/pkg/awsutil/session.go): `pkg/awsutil/session.go`
- [Account discovery](https://github.com/ekristen/aws-nuke/blob/main/pkg/awsutil/account.go): `pkg/awsutil/account.go`
- [Region handling](https://github.com/ekristen/aws-nuke/blob/main/pkg/nuke/region.go): `pkg/nuke/region.go`

### Cleanup workflow

- [Run confirmation](https://github.com/ekristen/aws-nuke/blob/main/pkg/nuke/prompt.go): `pkg/nuke/prompt.go`
- [Run orchestration](https://github.com/ekristen/aws-nuke/blob/main/pkg/commands/nuke/nuke.go): `pkg/commands/nuke/nuke.go`
- **Cleanup engine**
- **Resource scanning**
- [Resource operations](https://github.com/ekristen/aws-nuke/blob/main/pkg/nuke/resource.go): `pkg/nuke/resource.go`

### AWS resources

- [Resource registry](https://github.com/ekristen/aws-nuke/tree/main/resources): `resources`
- [AWS resource handlers](https://github.com/ekristen/aws-nuke/tree/main/resources): `resources`

### Other components

- **Operator**
- **AWS APIs**

## Connections

- Operator → CLI entry: invokes (evidence: `main.go`)
- CLI entry → Run command: registers command (evidence: `main.go`)
- CLI entry → Account explain: registers command (evidence: `main.go`)
- CLI entry → Config explain: registers command (evidence: `main.go`)
- CLI entry → Resource list: registers command (evidence: `main.go`)
- Run command → Config loader: loads (evidence: `pkg/commands/nuke/nuke.go`)
- Run command → Credentials and sessions: configures credentials (evidence: `pkg/commands/nuke/nuke.go`)
- Run command → Account discovery: identifies account
- Run command → Region handling: selects regions
- Run command → Run confirmation: registers prompt (evidence: `pkg/commands/nuke/nuke.go`)
- Run command → Resource registry: selects resource types (evidence: `pkg/commands/nuke/nuke.go`)
- Run command → Cleanup engine: starts run (evidence: `pkg/commands/nuke/nuke.go`)
- Cleanup engine → Resource scanning: scans resources
- Resource scanning → Resource operations: uses regional options
- Resource registry → AWS resource handlers: registers handlers (evidence: `resources/opensearchservice-pipeline.go`)
- AWS resource handlers → AWS APIs: lists and deletes (evidence: `resources/opensearchservice-pipeline.go`)
- Account explain → Config loader: loads (evidence: `pkg/commands/account/account.go`)
- Account explain → Credentials and sessions: validates credentials (evidence: `pkg/commands/account/account.go`)
- Account explain → Account discovery: discovers account (evidence: `pkg/commands/account/account.go`)
- Config explain → Config loader: loads (evidence: `pkg/commands/config/config.go`)
- Resource list → Resource registry: lists resource types (evidence: `pkg/commands/list/list.go`)
- Credentials and sessions → AWS APIs: authenticates requests
- Account discovery → AWS APIs: queries account
