Miscellaneous scripts for automating mundane tasks.
pip install -r requirements.txt- AWS credentials configured (
~/.aws/credentialsor environment variables) - IAM permission:
ce:GetCostAndUsage
Fetches last quarter's AWS costs from Cost Explorer and breaks them down three ways:
- Raw unblended cost — straight from Cost Explorer
- Cost excluding SavingsPlan negations — removes SP credit line items
- RI value — computes Reserved Instance value as
covered hours × hourly price
Final output is (2) + (3), giving a true apples-to-apples cost baseline.
Configure RI pricing (edit the file before running):
# scripts/aws/cost_baseline.py, line 8
RI_PRICING = {
"db.r6g.large": 0.1942, # add your instance types and hourly prices here
}Run:
python scripts/aws/cost_baseline.pySample output:
Range: 2026-01-01 → 2026-04-01
1. Raw cost:
{'2026-01-01': 12345.67, '2026-02-01': 11890.23, '2026-03-01': 12100.50}
2. Cost excluding SavingsPlanNegation:
{'2026-01-01': 13500.00, ...}
3. RI computed value (hours * price):
{'2026-01-01': 420.34, ...}
Final (2 + 3):
{'2026-01-01': 13920.34, ...}
Total: 41500.12