How kartiksharma0609/cloud-cost-guardian works
Cloud Cost Guardian is a Python CLI that scans AWS resources for waste, estimates monthly costs, and prints findings; optionally, it reports gross usage by billed service and which scanners cover it. Its main flow runs registered scanners independently, collecting each scanner’s findings and errors before the CLI formats the result. The source shows EBS volumes, ECR lifecycle gaps, and unassociated Elastic IPs, plus pricing fallbacks and Cost Explorer reporting. Edges reflect excerpted calls and registration; external AWS interactions are shown at the service boundary.
Main entry points: runner.py Scan runner · ebs.py EBS scanner · ecr.py ECR scanner · elastic_ip.py Elastic IP scanner
Components 15
CLI and orchestration
- CLI
src/guardian/cli.py - Scan runner
src/guardian/runner.py
Resource scanners
- Scanner registry
src/guardian/registry.py - Scanner discovery
src/guardian/scanners/__init__.py - EBS scanner
src/guardian/scanners/ebs.py - ECR scanner
src/guardian/scanners/ecr.py - Elastic IP scanner
src/guardian/scanners/elastic_ip.py
Pricing and spend
- Price provider
src/guardian/pricing.py - Spend retrieval
src/guardian/spend.py
Finding model
- Finding model
src/guardian/models.py
Other components
- Operator
- AWS EC2
- AWS ECR
- AWS Price List
- AWS Cost Explorer
Connections 28
- Operator → CLI: runs
- CLI → Scan runner: calls scan
src/guardian/cli.py - Scan runner → Scanner registry: reads scanners
src/guardian/runner.py - Scan runner → Scanner discovery: imports
src/guardian/runner.py - Scanner discovery → EBS scanner: loads modules
src/guardian/scanners/__init__.py - Scanner discovery → ECR scanner: loads modules
src/guardian/scanners/__init__.py - Scanner discovery → Elastic IP scanner: loads modules
src/guardian/scanners/__init__.py - EBS scanner → Scanner registry: registers
src/guardian/scanners/ebs.py - ECR scanner → Scanner registry: registers
src/guardian/scanners/ecr.py - Elastic IP scanner → Scanner registry: registers
src/guardian/scanners/elastic_ip.py - Scan runner → EBS scanner: dispatches
src/guardian/runner.py - Scan runner → ECR scanner: dispatches
src/guardian/runner.py - Scan runner → Elastic IP scanner: dispatches
src/guardian/runner.py - EBS scanner → AWS EC2: queries volumes
src/guardian/scanners/ebs.py - Elastic IP scanner → AWS EC2: queries addresses
src/guardian/scanners/elastic_ip.py - ECR scanner → AWS ECR: queries repositories
src/guardian/scanners/ecr.py - Scan runner → Price provider: creates provider
src/guardian/runner.py - EBS scanner → Price provider: gets price
src/guardian/scanners/ebs.py - ECR scanner → Price provider: gets estimate
src/guardian/scanners/ecr.py - Elastic IP scanner → Price provider: gets estimate
src/guardian/scanners/elastic_ip.py - Price provider → AWS Price List: looks up EBS
src/guardian/pricing.py - EBS scanner → Finding model: creates findings
src/guardian/scanners/ebs.py - ECR scanner → Finding model: creates findings
src/guardian/scanners/ecr.py - Elastic IP scanner → Finding model: creates findings
src/guardian/scanners/elastic_ip.py - CLI → Spend retrieval: optionally reports
src/guardian/cli.py - Spend retrieval → Scanner discovery: imports scanners
src/guardian/spend.py - Spend retrieval → Scanner registry: matches coverage
src/guardian/spend.py - Spend retrieval → AWS Cost Explorer: fetches usage
src/guardian/spend.py