Skip to content

gc

Dry-run discovery and interactive deletion of orphaned AWS resources left behind by failed deployments, deleted PR previews, or manual console changes — protecting your AWS bill without leaving the terminal.

  • Scans ECR repositories matching <project-name>-* for untagged images and batch-deletes them.
  • Scans CloudWatch log groups under /ecs/<project-name>-* (preview leftovers; the live /ecs/<project-name> group is never matched) and deletes them. On --target lambda projects it scans /aws/lambda/<project-name>-* instead, always excluding the live /aws/lambda/<project-name>-fn group.
  • Scans Elastic IPs and releases any without an association (stops the hourly unused-EIP charge).
  • Paginates all discovery APIs, so large accounts are fully scanned.
  • Prints a categorized dry-run summary with per-target counts before asking anything.
Terminal window
npx grada-run gc
npx grada-run gc --region eu-west-1
Flag Description
--region <region> Explicit AWS region override.
--project-name <name> Explicit project name override (defaults to app_name in terraform/main.tf, then the current directory name).

Deletion requires explicit interactive confirmation (Are you sure you want to permanently delete these orphaned resources? (y/N), defaulting to no). There is intentionally no --yes flag, so the command can never wipe resources from a CI pipeline by accident. Declining or cancelling deletes nothing; finding nothing skips the prompt entirely.