Where did my AWS money go? awstree reads your AWS bill and draws it as a treemap: big box, big cost.
It's one Python file with no dependencies to install, and it produces a single HTML page that works offline.
git clone <this repo> && cd awstree
python3 awstree.py --demo # try it with fake data, no AWS needed
python3 awstree.py --profile my-profile # your real billThe page opens in your browser. It shows the last 30 days, compared with the 30 days before.
- Treemap of spend by service → usage type. Press
2to group by account and3to group by region. - Color by change (
c): red where spend grew, green where it shrank. - Selection panel: cost, share of the bill, change vs the previous period, monthly pace and a daily chart.
- Worth a look: the fastest-growing costs plus common money pits: NAT data processing, idle IPs, gp2 volumes, old snapshots, previous-gen instances and extended-support fees.
- Export for AI: a JSON summary to hand to any AI agent (see below).
Click to select, double-click to zoom in, ⌫ to go back up, / to filter.
- Python 3.8+, plus the AWS CLI or
boto3 - Credentials with the
ce:GetCostAndUsagepermission. Run it from the management (payer) account to see every account in your organization. - Cost Explorer enabled in the Billing console. The very first time, it can take up to 24 hours before data shows up.
Cost: AWS charges $0.01 per Cost Explorer request, and a run makes about 4–10 requests. awstree saves the data, so reopening the page is free:
python3 awstree.py --from out/awstree-data.jsonpython3 awstree.py --from out/awstree-data.json --exportThis writes out/awstree-export.json, a compact summary (about 50 KB) that includes instructions for the agent. It has totals, breakdowns by service, account and region, every line item with its change vs the previous period, the top growers and the flagged money pits. Give it to an AI agent and ask "where can I save money?". The Export for AI button in the page (or e) downloads the same file.
| Flag | What it does |
|---|---|
--demo |
Fake data, no AWS access needed |
--profile NAME |
AWS profile to use (SSO and aws login work) |
--days N |
Period length, default 30. It's always compared with the period before it. |
--metric M |
UnblendedCost (default), AmortizedCost, NetUnblendedCost, NetAmortizedCost |
--from FILE |
Reopen saved data without calling AWS |
--export [FILE] |
Write the AI summary JSON instead of the page |
--out FILE |
Where to write the page (default out/awstree.html) |
--no-open |
Don't open the browser |
awstree only reads from Cost Explorer and never changes anything in your account. Everything it writes goes to out/, which is git-ignored because it contains your account IDs and costs. The page loads nothing from the internet. Share the HTML or export file only with people who should see your bill.
Inspired by disktree by Tobi Lütke: the same idea, pointed at a cloud bill instead of a disk.
awstree is not affiliated with or endorsed by Amazon Web Services.
