Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

costsweep

A small Go CLI that scans an AWS account for recurring waste, prices each item, and prints the annual total nobody at AWS adds up for you.

It checks four things:

Check Source What it catches
rightsizing Cost Explorer GetRightsizingRecommendation idle & oversized EC2 instances (AWS's own estimate)
unattached-ebs EC2 DescribeVolumes EBS volumes in the available state
idle-eip EC2 DescribeAddresses Elastic IPs associated with nothing
stale-snapshot EC2 DescribeSnapshots your snapshots older than -snapshot-age days

Install

go install github.com/rezmoss/costsweep@latest

Use

costsweep                      # scan default region, human table
costsweep -region eu-west-1    # a specific region
costsweep -format markdown     # for a PR comment or GitHub step summary
costsweep -format json | jq    # for a dashboard or Slack bot
costsweep -demo                # no AWS needed — runs on bundled sample data
costsweep -fail-over 1000      # exit 2 if annual waste >= $1000 (CI gate)

Try it with zero setup:

costsweep -demo
TYPE                   RESOURCE             REGION          MONTHLY     ANNUAL
------------------------------------------------------------------------------
rightsizing-terminate  i-04e1f7a9c2b3d5e60  us-east-1       138.70      1664
...
------------------------------------------------------------------------------
TOTAL (13 findings)                                         350.30      4204

IAM

Read-only. The tool never mutates anything — it prints what you should delete.

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": [
      "ce:GetRightsizingRecommendation",
      "ce:GetCostAndUsage",
      "ec2:DescribeVolumes",
      "ec2:DescribeAddresses",
      "ec2:DescribeSnapshots"
    ],
    "Resource": "*"
  }]
}

How it's built

Three blog posts walk through the whole thing, problem to CI gate:

  1. Cost Explorer, the project skeleton, and the first dollar figure
  2. The resource scanners — unattached volumes, idle IPs, stale snapshots
  3. Pricing, the report layer, and a CI gate

Estimates are exactly that — estimates. rightsizing passes through AWS's own savings numbers; the resource checks use a small static price book (see internal/pricing) that you can audit against the public pricing pages.

License

MIT

About

Read-only Go CLI that finds and prices recurring AWS waste—oversized EC2, unattached EBS, unused Elastic IPs, and stale snapshots—with CI budget gates.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages