Skip to content
Waste Detection

Waste Detection

The Waste Detection engine is the core diagnostic module of AWS Doctor. It scans your account for “zombie” resources—assets that are active and billing but provide zero value to your business.

How to Run

Use the waste subcommand to trigger a full scan across all supported services:

aws-doctor waste --region us-east-1

Waste Detection Scan

Selective Scanning

If you only want to scan specific AWS services, you can pass them as arguments to the subcommand. This is useful for faster execution or targeted cleanups.

ArgumentService
ec2EC2 instances, EBS volumes, snapshots, key pairs, AMIs.
elbApplication and Network Load Balancers.
s3S3 buckets and multipart uploads.
rdsRDS instances and snapshots.
lambdaLambda over-provisioned memory detection.
vpcNAT Gateways and idle VPC resources.
cloudwatchCloudWatch Log Groups without retention policies.
sagemakerSageMaker idle endpoint detection (zero invocations in 14 days).
ecrECR repositories without lifecycle policies, empty repositories, and untagged images.
secrets-managerSecrets Manager secrets not accessed within the idle threshold.
# Example: Scan only EC2 and SageMaker resources
aws-doctor waste ec2 sagemaker

Configuration Flags

The waste and report waste subcommands support specific flags to tune the detection logic:

FlagDefaultDescription
--lambda-memory-threshold10Memory utilization threshold (%) below which Lambda functions are flagged as over-provisioned.
--secrets-idle-days90Idle days threshold for flagging unused Secrets Manager secrets.

Region-Aware Cost Estimation

Every waste check that reports an estimated monthly cost uses live pricing data fetched directly from the AWS Pricing API at startup.

How it works

  1. When you run aws-doctor waste, the tool queries the AWS Pricing API for your configured region before executing any checks.
  2. The fetched rates are cached in memory for the duration of the command.
  3. Each waste check multiplies the resource’s usage (size, hours, count) by the region-specific rate to produce an accurate cost estimate.

Fallback behaviour

If the API call fails for any reason (insufficient permissions, network error, unsupported region), AWS Doctor silently falls back to built-in default rates based on us-east-1 pricing. The waste scan always completes — you will never see a hard failure because of pricing data.

Estimates produced without live pricing data will be based on us-east-1 defaults and may not reflect your actual region’s rates.
Permissions Required: pricing:GetProducts. Without it, the tool still works — estimates silently fall back to built-in defaults.

Categories of Detection

We group waste into primary infrastructure categories:


Why automate this?

In large organizations, developers often create temporary resources (testing an AMI, spinning up a sandbox EIP) and forget to delete them. Over time, these small charges aggregate into thousands of dollars of “infrastructure debt.”

AWS Doctor makes it trivial to run a weekly checkup and keep your account lean.