███████╗██╗ ██╗███████╗ ██████╗ ██████╗ ███████╗████████╗
██╔════╝██║ ██╔╝██╔════╝ ██╔═══██╗██╔═══██╗██╔════╝╚══██╔══╝
█████╗ █████╔╝ ███████╗ ██║ ██║██║ ██║███████╗ ██║
██╔══╝ ██╔═██╗ ╚════██║ ██║ ██║██║ ██║╚════██║ ██║
███████╗██║ ██╗███████║ ╚██████╔╝╚██████╔╝███████║ ██║
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═╝
██████╗ ██████╗ ███████╗████████╗ ██████╗ ██████╗ ████████╗
██╔══██╗██╔══██╗██╔════╝╚══██╔══╝ ██╔════╝ ██╔══██╗╚══██╔══╝
██████╔╝██║ ██║█████╗ ██║ ██║ ███╗██████╔╝ ██║
██╔══██╗██║ ██║██╔══╝ ██║ ██║ ██║██╔══██╗ ██║
██████╔╝╚██████╔╝███████╗ ██║ ╚██████╔╝██║ ██║ ██║
╚═════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝
The production playbook for reducing EKS costs by 40-60% — proven scripts, real savings, battle-tested at scale
Documentation · Scripts · Terraform Modules · Helm Charts · Real-World Cases
This is not a theory book. This is a battle-tested, production-ready playbook for reducing EKS costs by 40-60% using real code, real scripts, and real infrastructure patterns.
Every script in this repository has been run in production. Every configuration has saved real money. The numbers are not estimates—they are actual savings from real AWS accounts.
| Optimization | Typical Savings | Time to Implement |
|---|---|---|
| gp2 → gp3 migration | 20% of EBS cost | 5 minutes |
| Unattached EIP cleanup | $3.65/EIP/month | 2 minutes |
| VPC Endpoints (S3 + DynamoDB) | 60-100% of NAT cost | 15 minutes |
| Kubecost rightsizing | 30-50% of compute | 1 hour |
| Karpenter consolidation | 25-35% of compute | 2 hours |
| Spot engineering (ML) | 70-90% of ML compute | 4 hours |
| S3 lifecycle policies | 60-80% of old data | 30 minutes |
| RDS stop/start schedules | 63% of dev databases | 1 hour |
| RDS Reserved Instances | 40% of production DB | 30 minutes |
Total potential savings: 50-70% of your AWS bill
┌─────────────────────────────────────────────────────────────────────────────┐
│ YOUR EKS CLUSTER │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐ │
│ │ Kubecost │ │ Karpenter │ │ Spot Engineering │ │
│ │ │ │ │ │ │ │
│ │ • Cost per pod │ │ • Node autoscale │ │ • Checkpointing │ │
│ │ • Efficiency │◄──►│ • Price opt │ │ • Interruption │ │
│ │ • Rightsizing │ │ • Consolidation │ │ handling │ │
│ └─────────────────┘ └──────────────────┘ └─────────────────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ AWS Cloud │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
│ │ │ EC2 │ │ EBS │ │ RDS │ │ S3 │ │ NAT │ │ │
│ │ │ Spot/OD │ │ gp3 │ │ RI/Sched│ │ Lifecycle│ │ Endpoints│ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
2026-eks-cost-optimization-handbook/
├── .github/workflows/ # CI/CD for cost audits
├── docs/ # Detailed documentation
├── scripts/
│ ├── waste-audit/ # Find and eliminate waste
│ ├── kubecost/ # Deploy and use Kubecost
│ ├── karpenter/ # Install and configure Karpenter
│ ├── spot-engineering/ # Spot instance checkpointing
│ ├── storage/ # S3 and ECR lifecycle policies
│ ├── database/ # RDS optimization
│ ├── network/ # VPC Endpoints
│ └── production-readiness/ # Validation scripts
├── terraform/ # Infrastructure as Code
├── helm/ # Cost-optimized Helm charts
├── monitoring/ # Prometheus rules + Grafana dashboards
├── Makefile # One-command operations
└── README.md # This file
Run these commands to see your current waste and potential savings:
# Clone the repository
git clone https://github.com/aayostem/2026-eks-cost-optimization-handbook.git
cd 2026-eks-cost-optimization-handbook
# Set your environment variables
export ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
export REGION=us-east-1
export CLUSTER_NAME=your-eks-cluster-name
# Run the waste audit — finds all your hidden waste
./scripts/waste-audit/waste-summary.sh
# Deploy Kubecost
./scripts/kubecost/install-kubecost.sh
# Wait 10 minutes, then get rightsizing recommendations
./scripts/kubecost/get-rightsizing-recommendations.sh
# Deploy Karpenter
./scripts/karpenter/install-karpenter.sh
# Apply S3 lifecycle policies to all buckets
./scripts/storage/bulk-apply-s3-lifecycle.shmake audit
# Or run scripts individually:
./scripts/waste-audit/find-gp2-volumes.sh
./scripts/waste-audit/find-unattached-eips.sh
./scripts/waste-audit/find-stopped-instances.sh
./scripts/waste-audit/find-unattached-volumes.sh
./scripts/waste-audit/waste-summary.shmake kubecost
# Then:
kubectl port-forward -n kubecost service/kubecost-cost-analyzer 9090:9090
# Open http://localhost:9090make karpenter
make test-karpentermake spot
# Update your training code with checkpoint_manager.py
kubectl apply -f scripts/spot-engineering/training-job.yamlmake storage database networkmake verifymake all| Company | Starting Bill | After Optimizations | Savings | Time |
|---|---|---|---|---|
| FinTech Startup (Series A) | $47,000/month | $19,404/month | $27,596/month (59%) | 2 weeks |
| E-commerce Platform | $124,000/month | $68,200/month | $55,800/month (45%) | 3 weeks |
| ML Research Lab | $31,000/month | $12,400/month | $18,600/month (60%) | 1 week |
Detailed case studies in docs/12-real-world-case-studies.md
kubectl port-forward -n kubecost service/kubecost-cost-analyzer 9090:9090
# Open http://localhost:9090# Import monitoring/grafana-dashboards/cost-dashboard.json# GitHub Actions runs every Monday at 9 AM UTC
# See .github/workflows/cost-audit.yml| Requirement | Version | Verification |
|---|---|---|
| AWS CLI | latest | aws sts get-caller-identity |
| kubectl | 1.29+ | kubectl version |
| Helm | 3.14+ | helm version |
| eksctl | latest | eksctl version |
| jq | 1.6+ | jq --version |
| bc | any | bc --version |
export ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
export REGION=us-east-1
export CLUSTER_NAME=your-cluster-name| Document | Description |
|---|---|
| Introduction | Why this handbook exists |
| Prerequisites | Required tools and permissions |
| Waste Audit | Find all hidden waste |
| Kubecost Deployment | Deploy and use Kubecost |
| Rightsizing | Apply Kubecost recommendations |
| Karpenter Deployment | Install and configure Karpenter |
| Spot Engineering | ML workloads on Spot |
| Storage Optimization | S3 and ECR lifecycle |
| Database Optimization | RDS stop/start and RIs |
| Network Optimization | VPC Endpoints |
| Production Readiness | Validation checks |
| Case Studies | Real customer results |
| FAQ & Troubleshooting | Common issues and fixes |
| Command | Description |
|---|---|
make audit |
Run waste audit |
make kubecost |
Deploy Kubecost |
make karpenter |
Deploy Karpenter |
make spot |
Deploy Spot engineering components |
make storage |
Apply S3 and ECR lifecycle policies |
make database |
Deploy RDS scheduler and purchase RIs |
make network |
Create VPC Endpoints |
make all |
Run all optimizations in sequence |
make verify |
Run production readiness check |
make clean |
Remove temporary files |
See CONTRIBUTING.md for guidelines.
MIT License © 2026 aayostem
If this handbook saves you money, please star the repository.
Start saving money today.
git clone https://github.com/aayostem/2026-eks-cost-optimization-handbook.git
cd 2026-eks-cost-optimization-handbook
make audit