Scripts, strategies, and guides for reducing AWS spend β by @ars-devsecops
Real result: ~20% AWS monthly cost reduction across client accounts at Flentas Technologies
| Path | Description |
|---|---|
| scripts/ec2_rightsizing.py | Analyzes EC2 CPU metrics β flags over-provisioned instances |
| savings-plans/savings-plans-strategy.md | Framework for Savings Plans & Reserved Instance decisions |
| reports/ | Sample cost reports (anonymized) |
# Install dependencies
pip install boto3
# Configure AWS credentials
aws configure
# Run right-sizing analysis (14-day lookback)
python3 scripts/ec2_rightsizing.py --region ap-south-1 --days 14
# Save results to CSV
python3 scripts/ec2_rightsizing.py --region ap-south-1 --days 30 --output report.csv==========================================================================================
EC2 RIGHT-SIZING REPORT | 15 instances analyzed | Potential monthly saving: $340
==========================================================================================
Instance ID Name Type Avg CPU Max CPU Suggested Saving/mo
------------------------------------------------------------------------------------------
i-0abc123def456789a prod-api-server-01 m5.2xlarge 12.3% 38.1% m5.xlarge $140
i-0abc123def456789b prod-worker-02 m5.xlarge 8.7% 22.4% m5.large $70
i-0abc123def456789c staging-app-01 t3.large 6.1% 15.2% t3.medium $34
==========================================================================================
π Instances to downsize: 8
π° Total potential saving: $340/month ($4,080/year)
==========================================================================================
| Strategy | Typical Saving |
|---|---|
| Right-size over-provisioned EC2 | 20β40% on affected instances |
| Convert On-Demand β Savings Plans | 30β60% on covered usage |
| Stop dev/test outside business hours | ~65% on those instances |
| Delete unattached EBS volumes | Varies |
| S3 Intelligent-Tiering | 20β40% on storage costs |
| Reduce CloudWatch log retention | Varies |