CLI Usage

February 27, 2026 ยท View on GitHub

Commands

CommandDescription
cloud-nuke awsDelete all resources (with confirmation prompt)
cloud-nuke inspect-awsInspect resources without deleting
cloud-nuke defaults-awsDelete default VPCs and default security group rules
cloud-nuke gcpDelete GCP resources (with confirmation prompt)
cloud-nuke inspect-gcpInspect GCP resources without deleting

Flags

Filtering

FlagDescriptionAvailable in
--regionTarget specific regions (repeatable)aws, inspect-aws, defaults-aws
--exclude-regionExclude regions (repeatable, mutually exclusive with --region)aws, inspect-aws, defaults-aws
--resource-typeTarget specific resource types (repeatable)aws, inspect-aws, gcp, inspect-gcp
--exclude-resource-typeExclude resource types (repeatable, mutually exclusive with --resource-type)aws, inspect-aws, gcp, inspect-gcp
--older-thanOnly target resources older than duration (Go duration)aws, inspect-aws, gcp, inspect-gcp
--newer-thanOnly target resources newer than durationaws, inspect-aws, gcp, inspect-gcp
--configPath to config file for granular filteringaws, gcp
--exclude-first-seenExclude resources based on first-seen tagaws, inspect-aws

Execution

FlagDescriptionAvailable in
--dry-runPreview deletions without executingaws, gcp
--forceSkip confirmation promptaws, gcp, defaults-aws
--timeoutSet execution timeout (e.g., 10m)aws, gcp
--sg-onlyOnly delete default security group rules, not VPCsdefaults-aws

Output

FlagDescriptionAvailable in
--log-levelLog verbosity: debug, info (default), warn, error, panic, fatal, trace. Also settable via LOG_LEVEL env var.all
--output-formatOutput format: table (default), jsonaws, inspect-aws, gcp, inspect-gcp
--output-fileWrite output to file instead of stdoutaws, inspect-aws, gcp, inspect-gcp
--list-resource-typesList all supported resource type identifiersaws, inspect-aws, gcp, inspect-gcp

KMS

FlagDescriptionAvailable in
--delete-unaliased-kms-keysDelete KMS keys without aliasesaws
--list-unaliased-kms-keysList KMS keys without aliasesinspect-aws

GCP

FlagDescriptionAvailable in
--project-idGCP project ID (required)gcp, inspect-gcp

Examples

# Nuke everything in specific regions
cloud-nuke aws --region us-east-1 --region us-west-2

# Nuke only EC2 and S3, skip confirmation
cloud-nuke aws --resource-type ec2 --resource-type s3 --force

# Dry run with config file
cloud-nuke aws --dry-run --config path/to/config.yaml

# Inspect with specific AWS profile
AWS_PROFILE=dev cloud-nuke inspect-aws --region us-east-1

# Nuke only default security group rules
cloud-nuke defaults-aws --sg-only

# JSON output to file
cloud-nuke inspect-aws --output-format json --output-file results.json

# Nuke GCP resources
cloud-nuke gcp --project-id my-project-id --resource-type compute-instance

CLI flags override config file options. If you pass --resource-type s3 but your config only defines rules for ec2, only s3 is targeted.

Protect Resources with cloud-nuke-after Tag

Tag resources with cloud-nuke-after and an ISO 8601 date (e.g., 2024-07-09T00:00:00Z) to protect them from deletion until that date.

Note on Nuking VPCs

Cloud-nuke automatically removes VPC dependencies: Internet Gateways, Egress Only Internet Gateways, ENIs, VPC Endpoints, Subnets, Route Tables, Network ACLs, Security Groups, and DHCP Option Sets (dissociated only). Elastic IPs are cleaned up as a separate resource first.

All other VPC sub-resources must be cleaned up before nuking VPCs.

VPC cleanup may not fully complete on the first run due to AWS eventual consistency. If you see InvalidParameterValue: Network interface is currently in use., wait 30 minutes and retry.