Skip to content

mjfxjas/aws-cost-optimizer

Repository files navigation

AWS Cost Optimizer

CI PyPI

Automated AWS cost optimization recommendations based on production experience achieving 60% cost reduction.

Features

  • DynamoDB Analysis: Identify tables that should use provisioned capacity
  • Lambda Analysis: Find functions without reserved concurrency limits
  • S3 Analysis: Detect buckets missing lifecycle policies
  • CloudFront Analysis: Identify distributions with suboptimal cache settings
  • Rich CLI: Beautiful terminal output with actionable recommendations

Installation

pip install aws-cost-optimizer

Quick Start

# Analyze all services
aws-cost-optimizer analyze

# Analyze specific service
aws-cost-optimizer analyze --service dynamodb

# Bulk apply workflow (safe-first)
aws-cost-optimizer apply --all --service all --dry-run

# Live execute (requires explicit --execute)
aws-cost-optimizer apply --all --service all --execute

# Single-resource workflow
aws-cost-optimizer apply --service dynamodb my-table --dry-run
aws-cost-optimizer apply --service dynamodb my-table --execute

# Interactive menu/hub (includes "Apply all (EXECUTE)")
aws-cost-optimizer menu

Common Operator Flows

A few high-signal commands to show what the tool is for:

# Full analysis pass across supported services
aws-cost-optimizer analyze

# Guided terminal experience
aws-cost-optimizer menu

# Safe bulk apply preview
aws-cost-optimizer apply --all --service all --dry-run

Smoke Test

Quick verification that install and CLI wiring are healthy:

python3 -m pip install --upgrade aws-cost-optimizer
aws-cost-optimizer --help
python3 -c "from importlib.metadata import version; print(version('aws-cost-optimizer'))"

Security Checks

  • CI runs Bandit static security analysis on src/aws_cost_optimizer (Python 3.11 job).
  • Failing threshold is set to medium-or-higher severity/confidence.
bandit -r src/aws_cost_optimizer --severity-level medium --confidence-level medium

Example Output

Service: DynamoDB | Resource: my-table | Issue: Using on-demand | Savings: ~40-60% | Action: Switch to provisioned
Service: Lambda | Resource: my-function | Issue: No concurrency limit | Savings: Prevent overruns | Action: Set reserved concurrency
Service: S3 | Resource: my-bucket | Issue: No lifecycle policy | Savings: ~20-30% | Action: Add lifecycle rules

Real-World Results

This tool is based on optimizations that achieved:

  • 60% cost reduction on production serverless application
  • 90% reduction in Lambda invocations via CloudFront caching
  • Predictable costs through provisioned capacity

Requirements

  • Python 3.9+
  • AWS credentials configured
  • IAM permissions for read access to analyzed services

Development

git clone https://github.com/mjfxjas/aws-cost-optimizer
cd aws-cost-optimizer
pip install -e .

License

MIT. See LICENSE.

Changelog

See CHANGELOG.md for versioned release notes.

Author

Jonathan Schimpf - jon@theatrico.org

AWS Solutions Architect Associate with production experience optimizing cloud costs.

About

CLI tool for analyzing and optimizing AWS costs

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors