AWS Cost Calculator CLI - Calculate daily and annual AWS costs across multiple accounts
Project description
AWS Cost Calculator (cc)
A CLI tool to quickly calculate AWS costs across multiple accounts.
Installation
cd ~/cost-calculator
pip install -e .
Quick Start
1. Login to AWS SSO
aws sso login --profile my_aws_profile
Note: You need to do this before running cost calculations. The SSO session typically lasts 8-12 hours.
2. Initialize a profile
cc init --profile myprofile \
--aws-profile my_aws_profile \
--accounts "123456789012,234567890123,345678901234"
3. Calculate costs
# Default: Today minus 2 days, going back 30 days
cc calculate --profile myprofile
# Specific start date
cc calculate --profile myprofile --start-date 2025-11-04
# Custom offset and window
cc calculate --profile myprofile --offset 2 --window 30
# JSON output
cc calculate --profile myprofile --json-output
4. List profiles
cc list-profiles
How It Works
Date Calculation
- Start Date: Defaults to today, or specify with
--start-date - Offset: Days to go back from start date (default: 2)
- Window: Number of days to analyze (default: 30)
Example: If today is Nov 4, 2025:
- With offset=2, window=30: Analyzes Oct 3 - Nov 2 (30 days)
Cost Calculation
- Operational Costs: Sum of daily costs ÷ window days
- Support Allocation:
- Gets support cost from the analysis month
- Divides by 2 (50% allocation)
- Divides by days in that month
- Daily Rate: Operational + Support per day
- Annual Projection: Daily rate × 365
Filters Applied
- Billing Entity: AWS only (excludes marketplace)
- Excluded: Tax, Support (calculated separately)
- Metric: Net Amortized Cost
Configuration
Profiles are stored in: ~/.config/cost-calculator/profiles.json
Example:
{
"myprofile": {
"aws_profile": "my_aws_profile",
"accounts": ["123456789012", "234567890123", "345678901234"]
}
}
Examples
# Quick daily check
cc calculate --profile myprofile
# Historical analysis
cc calculate --profile myprofile --start-date 2025-10-01
# Export to JSON for processing
cc calculate --profile myprofile --json-output > costs.json
# Different window size
cc calculate --profile myprofile --window 60
Output
Analyzing: 2025-10-03 to 2025-11-02 (30 days)
AWS Profile: my_aws_profile
Accounts: 3
Fetching cost data...
Fetching support costs...
============================================================
Period: 2025-10-03 to 2025-11-02
Days analyzed: 30
============================================================
Total operational cost: $450,000.00
Daily operational: $14,516.13
Support (month): $15,000.00
Support per day (÷2÷days): $241.94
============================================================
DAILY RATE: $14,758.07
ANNUAL PROJECTION: $5,386,695
============================================================
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aws_cost_calculator_cli-1.0.3.tar.gz.
File metadata
- Download URL: aws_cost_calculator_cli-1.0.3.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
775566237c45c3619f985b9fba4819094ba99b51b43a689ea28512c08a3a6f3c
|
|
| MD5 |
fa4c46efd6beb78b19b08017da0e36a9
|
|
| BLAKE2b-256 |
04112898b60c532ebb5c502048072bb57eb7a2b9829ae38c80c9b641b3928e6d
|
File details
Details for the file aws_cost_calculator_cli-1.0.3-py3-none-any.whl.
File metadata
- Download URL: aws_cost_calculator_cli-1.0.3-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0935522459a7477855b8913a6099cb96ab9c5222edcf4c9899a7628c82a1386
|
|
| MD5 |
273e7164382d8570d9ae3237b56ccbf0
|
|
| BLAKE2b-256 |
6c15702064031493de327670627e8e7671bf1547f83018402ba84889b2ed88a8
|