DEV Community

Cover image for Nuking AWS Resources Safely with aws-nuke
Athreya aka Maneshwar
Athreya aka Maneshwar

Posted on • Edited on

Nuking AWS Resources Safely with aws-nuke

Hello, I'm Maneshwar. I'm building git-lrc, an AI code reviewer that runs on every commit. It is free, unlimited, and source-available on Github. Star Us to help devs discover the project. Do give it a try and share your feedback for improving the product.

Managing cloud resources across multiple AWS services and regions can quickly get messy, especially during development or testing.

If you need to safely and completely wipe out specific AWS resources across all regions, aws-nuke is one of the most efficient tools available.

This post walks through how to:

  • Configure aws-nuke to remove selected resource types
  • Execute a nuke with region-wide coverage
  • Bypass alias checks when working with non-production accounts

Step 1: Prepare Your nuke-resources.yaml

This configuration instructs aws-nuke to scan all regions, target only specific resources, and bypass the alias check for safety in test/dev accounts.

regions:
  - all

blocklist:
  - "000000000000" # dummy account

no-account-alias: true
no-blocklist-terms-default: true

accounts:
  "042000000000":
    presets: []

resource-types:
  includes:
    - ECRRepository
    - RDSDBSecurityGroup
    - GlacierVault
    - AppRunnerAutoScalingConfiguration
    - KMSKey
    - CloudTrailChannel
    - EventBus
    - ElastiCacheUser
    - ECSCapacityProvider
    - EC2SecurityGroupRule
    - EC2DHCPOption
    - EC2KeyPair
    - MemoryDBParameterGroup
    - MemoryDBUser
    - MemoryDBACL

bypass-alias-check-accounts:
  - "042000000000"
Enter fullscreen mode Exit fullscreen mode

Step 2: Review with explain-config

Before you delete anything, review the plan with:

aws-nuke explain-config -c nuke-resources.yaml --profile default
Enter fullscreen mode Exit fullscreen mode

This lets you confirm exactly which resource types are in scope.


Step 3: Run the Nuke

Once you're sure, run the actual nuke with:

aws-nuke nuke --config nuke-resources.yaml --no-dry-run --no-alias-check --log-level debug
Enter fullscreen mode Exit fullscreen mode

You'll be prompted with a final safety confirmation. Since alias checks are bypassed, you'll need to enter the alias shown (e.g., no-alias-042000000000) to proceed.

Notes

  • Only specified resource types are included. Everything else is untouched.
  • The --no-alias-check is useful for automation or dev accounts that don’t have aliases set up.
  • Always dry-run first unless you're absolutely sure.

Conclusion

aws-nuke provides powerful control over AWS environments, making cleanup painless. With scoped includes and account safeguards, you can surgically nuke only what’s necessary — and sleep easy knowing production is safe.

git-lrc
*AI agents write code fast. They also silently remove logic, change behavior, and introduce bugs -- without telling you. You often find out in production.

git-lrc fixes this. It hooks into git commit and reviews every diff before it lands. 60-second setup. Completely free.*

Any feedback or contributors are welcome! It's online, source-available, and ready for anyone to use.

⭐ Star it on GitHub:

GitHub logo HexmosTech / git-lrc

Free, Unlimited AI Code Reviews That Run on Commit




AI agents write code fast. They also silently remove logic, change behavior, and introduce bugs -- without telling you. You often find out in production.

git-lrc fixes this. It hooks into git commit and reviews every diff before it lands. 60-second setup. Completely free.

See It In Action

See git-lrc catch serious security issues such as leaked credentials, expensive cloud operations, and sensitive material in log statements

git-lrc-intro-60s.mp4

Why

  • 🤖 AI agents silently break things. Code removed. Logic changed. Edge cases gone. You won't notice until production.
  • 🔍 Catch it before it ships. AI-powered inline comments show you exactly what changed and what looks wrong.
  • 🔁 Build a

Top comments (0)