Dawnfix

Sample teardown plan

Synthetic: the test suite's made-up account 123456789012 and example.com zone. No real account. Account 123456789012, cutover 2026-09-01, us-east-1. Nothing was deleted.

Estimated waste$264.92a month
Safe to delete14$117.36/month
Verify first8$147.56/month

Items, in teardown order

KindNameWhy$/month
deleteRoute 53 recordsapi.example.com. A (example.com.)
Z1/api.example.com./A
points at gone-lb-999.us-east-1.elb.amazonaws.com: no such load balancer exists any more (dangling)$0.00
records are free; dangling ones are a subdomain-takeover risk
verifyRoute 53 recordslegacy.example.com. CNAME (example.com.)
Z1/legacy.example.com./CNAME
points at legacy-clb-1.us-east-1.elb.amazonaws.com, which this plan tears down: delete the record first$0.00
records are free; dangling ones are a subdomain-takeover risk
verifyRoute 53 recordsold.example.com. CNAME (example.com.)
Z1/old.example.com./CNAME
points at legacy-prod.us-east-1.elasticbeanstalk.com, which this plan tears down: delete the record first$0.00
records are free; dangling ones are a subdomain-takeover risk
deleteECS serviceszero
arn:aws:ecs:us-east-1:123456789012:service/c1/zero
desired count is 0$0.00
no running tasks; it still pins its target group and task definition
deleteBeanstalk environmentslegacy-prod
e-old
environment status Ready, health Grey, last updated before the cutover$15.18
EC2 + load balancer hourly: t3.small
deleteBeanstalk applicationslegacyevery live environment is in this plan$0.00
applications are free; stored application versions in S3 are not counted
deleteLoad balancersold-lb
arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/old-lb/1111111111111111
none of its 1 target group(s) has a healthy target$23.73
application load balancer hourly charge, no LCU + 2 public IPv4
deleteClassic load balancerslegacy-clbnone of its 1 registered instance(s) is InService$25.55
classic load balancer hourly charge, no data + 2 public IPv4
deleteTarget groupsempty-tg
arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/empty-tg/cccccccccccccccc
zero registered targets$0.00
target groups are free; this is clutter that hides real config
deleteNAT gatewaysnat-idleno bytes out since the cutover; wait for the gateway to reach `deleted` before releasing its Elastic IP$36.50
NAT gateway hourly charge + 1 public IPv4; data processing ($0.045/GB) is zero while idle
verifyStopped EC2 instancesold-worker
i-stopped
t3.large stopped since 2026-08-01; vol-data survive termination (DeleteOnTermination is off): delete them after$24.00
EBS storage of 2 attached volume(s); a stopped instance bills no compute
verifyRDS instanceslegacy-dbno connections since the cutover (peak DatabaseConnections 0); deletion protection is on: turn it off with modify-db-instance first$64.06
100 GB gp3 storage, db.t3.medium postgres hours; backups and I/O not counted
verifyRDS instancesstopped-dbstopped; AWS starts a stopped instance again after 7 days, and compute bills again$11.50
50 GB gp2 storage (Multi-AZ, x2); backups and I/O not counted
verifyRDS manual snapshotsorphan-finalmanual snapshot of deleted-db, which no longer exists: it may be the last copy of that database (keep one, or export it to S3 first)$47.50
allocated size at backup storage price; billed size is smaller (incremental), so an upper bound
deleteRDS manual snapshotspre-migrationmanual snapshot of live-db taken before the cutover; live-db has newer backups$1.90
allocated size at backup storage price; billed size is smaller (incremental), so an upper bound
verifyAMIslegacy-app-2026-05
ami-old
AMI created before the cutover and not used by any running or stopped instance$0.00
AMIs are billed through their backing snapshots (listed separately)
deleteEBS snapshotssnap-amibacks ami-old, which this plan deregisters$0.20
full snapshot size; billed size is the changed blocks, so this is an upper bound
verifyEBS snapshotsThis snapshot is created by the AWS Backup service.
snap-backup
snapshot taken before the cutover; managed by AWS Backup or Data Lifecycle Manager: change the plan/policy instead$0.50
source volume size; billed size is the changed blocks, so this is an upper bound
deleteEBS snapshotspre-migration backup
snap-old
snapshot taken before the cutover$2.50
source volume size; billed size is the changed blocks, so this is an upper bound
deleteEBS volumesold-db-data
vol-old
gp3 100 GiB volume, attached to nothing$8.00
gp3 storage + provisioned IOPS
deleteElastic IPs52.0.0.1
eipalloc-free
Elastic IP not associated with anything$3.65
public IPv4 hourly charge
deleteLog groups/aws/elasticbeanstalk/legacy-prod/var/log/web.stdout.logno events since 2026-08-20T00:00:00Z$0.15
5.00 GB stored

Commands, in this order

For a human to review and run, top to bottom. Lines marked # VERIFY need a check first; optional backups are commented out.

# --- 1. Route 53 records
aws route53 change-resource-record-sets --hosted-zone-id Z1 --change-batch '{"Changes":[{"Action":"DELETE","ResourceRecordSet":{"AliasTarget":{"DNSName":"dualstack.gone-lb-999.us-east-1.elb.amazonaws.com.","EvaluateTargetHealth":false,"HostedZoneId":"Z35SXDOTRQ7X7K"},"Name":"api.example.com.","Type":"A"}}],"Comment":"sweeper teardown"}'
# VERIFY: points at legacy-clb-1.us-east-1.elb.amazonaws.com, which this plan tears down: delete the record first
aws route53 change-resource-record-sets --hosted-zone-id Z1 --change-batch '{"Changes":[{"Action":"DELETE","ResourceRecordSet":{"Name":"legacy.example.com.","ResourceRecords":[{"Value":"legacy-clb-1.us-east-1.elb.amazonaws.com"}],"TTL":60,"Type":"CNAME"}}],"Comment":"sweeper teardown"}'
# VERIFY: points at legacy-prod.us-east-1.elasticbeanstalk.com, which this plan tears down: delete the record first
aws route53 change-resource-record-sets --hosted-zone-id Z1 --change-batch '{"Changes":[{"Action":"DELETE","ResourceRecordSet":{"Name":"old.example.com.","ResourceRecords":[{"Value":"legacy-prod.us-east-1.elasticbeanstalk.com"}],"TTL":300,"Type":"CNAME"}}],"Comment":"sweeper teardown"}'
# --- 2. ECS services
aws ecs delete-service --cluster arn:aws:ecs:us-east-1:123456789012:cluster/c1 --service zero --region us-east-1
# --- 3. Beanstalk environments
aws elasticbeanstalk terminate-environment --environment-id e-old --region us-east-1
# --- 4. Beanstalk applications
aws elasticbeanstalk delete-application --application-name legacy --region us-east-1
# --- 5. Load balancers
aws elbv2 delete-load-balancer --load-balancer-arn arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/old-lb/1111111111111111 --region us-east-1
# --- 6. Classic load balancers
aws elb delete-load-balancer --load-balancer-name legacy-clb --region us-east-1
# --- 7. Target groups
aws elbv2 delete-target-group --target-group-arn arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/empty-tg/cccccccccccccccc --region us-east-1
# --- 8. NAT gateways
aws ec2 delete-nat-gateway --nat-gateway-id nat-idle --region us-east-1
aws ec2 release-address --allocation-id eipalloc-nat --region us-east-1
# --- 9. Stopped EC2 instances
# VERIFY: t3.large stopped since 2026-08-01; vol-data survive termination (DeleteOnTermination is off): delete them after
# backup: aws ec2 create-image --instance-id i-stopped --name pre-teardown-i-stopped --no-reboot --region us-east-1
aws ec2 terminate-instances --instance-ids i-stopped --region us-east-1
# --- 10. RDS instances
# VERIFY: no connections since the cutover (peak DatabaseConnections 0); deletion protection is on: turn it off with modify-db-instance first
aws rds delete-db-instance --db-instance-identifier legacy-db --final-db-snapshot-identifier legacy-db-final-20261027 --region us-east-1
# VERIFY: stopped; AWS starts a stopped instance again after 7 days, and compute bills again
aws rds delete-db-instance --db-instance-identifier stopped-db --final-db-snapshot-identifier stopped-db-final-20261027 --region us-east-1
# --- 11. RDS manual snapshots
# VERIFY: manual snapshot of deleted-db, which no longer exists: it may be the last copy of that database (keep one, or export it to S3 first)
aws rds delete-db-snapshot --db-snapshot-identifier orphan-final --region us-east-1
aws rds delete-db-snapshot --db-snapshot-identifier pre-migration --region us-east-1
# --- 12. AMIs
# VERIFY: AMI created before the cutover and not used by any running or stopped instance
aws ec2 deregister-image --image-id ami-old --region us-east-1
# --- 13. EBS snapshots
aws ec2 delete-snapshot --snapshot-id snap-ami --region us-east-1
# VERIFY: snapshot taken before the cutover; managed by AWS Backup or Data Lifecycle Manager: change the plan/policy instead
aws ec2 delete-snapshot --snapshot-id snap-backup --region us-east-1
aws ec2 delete-snapshot --snapshot-id snap-old --region us-east-1
# --- 14. EBS volumes
# backup: aws ec2 create-snapshot --volume-id vol-old --description 'pre-teardown copy of vol-old' --region us-east-1
aws ec2 delete-volume --volume-id vol-old --region us-east-1
# --- 15. Elastic IPs
aws ec2 release-address --allocation-id eipalloc-free --region us-east-1
# --- 16. Log groups
aws logs delete-log-group --log-group-name /aws/elasticbeanstalk/legacy-prod/var/log/web.stdout.log --region us-east-1

Notes

  • 1 Aurora cluster member(s) in us-east-1 were not checked (clusters are not covered yet).
  • 1 Route 53 record(s) point at load balancers or Beanstalk environments in regions that were not scanned; pass those regions with --region to check them.
  • A/AAAA records with plain IPs were not checked; pass --ip-ranges ip-ranges.json (https://ip-ranges.amazonaws.com/ip-ranges.json) to flag IPs in AWS EC2 space that this account no longer owns.

Back to Dawnfix Sweeper