ScriptsApr 16, 2026·3 min read

Cloud Nuke — Wipe AWS Resources with a Single Command

A CLI tool from Gruntwork for cleaning up AWS accounts by deleting all resources across regions. Cloud Nuke is essential for tearing down sandbox environments, reducing cloud costs, and preventing resource sprawl.

TL;DR
Gruntwork CLI tool that deletes all AWS resources across regions in one command for sandbox cleanup and cost control.
§01

What it is

Cloud Nuke is a CLI tool from Gruntwork that deletes AWS resources across all regions in a single command. It supports EC2 instances, S3 buckets, Lambda functions, IAM roles, VPCs, RDS databases, and dozens of other resource types. You can filter by resource type, region, age, and tags.

Cloud Nuke targets DevOps engineers and platform teams who manage sandbox, development, and testing AWS accounts. It solves the problem of resource sprawl where forgotten resources accumulate and generate unexpected cloud bills.

§02

How it saves time or tokens

Manually deleting AWS resources through the console requires clicking through each service in each region. Cloud Nuke automates this across all regions and resource types in seconds. For organizations with multiple sandbox accounts, running Cloud Nuke on a schedule prevents cost surprises from forgotten resources.

§03

How to use

  1. Install Cloud Nuke via Homebrew or download the binary.
  2. Configure AWS credentials.
  3. Run the nuke command with appropriate filters.
# Install
brew install cloud-nuke

# Delete ALL resources in an account (dangerous)
cloud-nuke aws

# Delete resources older than 24 hours
cloud-nuke aws --older-than 24h

# Delete only specific resource types
cloud-nuke aws --resource-type ec2 --resource-type s3

# Delete resources in specific regions only
cloud-nuke aws --region us-east-1 --region eu-west-1

# Dry run (list what would be deleted)
cloud-nuke aws --dry-run
§04

Example

# cloud-nuke config file for targeted cleanup
# .cloud-nuke.yml
ec2:
  include:
    names_regex:
      - 'dev-.*'
      - 'test-.*'
  exclude:
    names_regex:
      - 'prod-.*'

s3:
  include:
    names_regex:
      - '.*-sandbox-.*'
§05

Related on TokRepo

§06

Common pitfalls

  • Cloud Nuke deletes resources permanently. There is no undo. Always use --dry-run first and restrict to sandbox accounts. Never run against production AWS accounts.
  • Some resources have deletion dependencies (e.g., VPCs cannot be deleted while ENIs are attached). Cloud Nuke handles most dependencies but may fail on complex resource graphs.
  • IAM resource deletion can break other accounts if the IAM roles are used cross-account. Exclude IAM resources unless you are certain they are scoped to the target account.

Frequently Asked Questions

Is Cloud Nuke safe to use on production accounts?+

No. Cloud Nuke is designed for sandbox and development accounts. Running it on a production account will delete production resources permanently. Use AWS Organizations to isolate sandbox accounts and restrict Cloud Nuke access to those accounts only.

What AWS resources does Cloud Nuke support?+

Cloud Nuke supports EC2, S3, Lambda, RDS, DynamoDB, ECS, EKS, IAM, VPC, CloudWatch, SNS, SQS, Elastic Beanstalk, and dozens more. The full list is in the GitHub README. New resource types are added regularly.

Can I schedule Cloud Nuke to run automatically?+

Yes. You can run Cloud Nuke as a cron job, Lambda function, or CI/CD pipeline step. A common pattern is to schedule nightly cleanup of resources older than 48 hours in sandbox accounts. Use the --force flag to skip confirmation prompts in automated runs.

How does Cloud Nuke handle multi-region resources?+

Cloud Nuke scans all enabled AWS regions by default. It queries each region in parallel for supported resource types and deletes them. You can restrict to specific regions using the --region flag if you only want to clean certain regions.

Does Cloud Nuke support filtering by tags?+

Yes. You can use the config file to include or exclude resources based on name patterns. Tag-based filtering is supported through name regex patterns. This lets you protect specific resources while nuking everything else in a sandbox account.

Citations (3)

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets