AWS Builder Center

AWS Cost Detective

Building an AWS Cost Detective — a possible architecture

AWS gives us powerful tools to explore costs, detect anomalies and analyse usage. But I keep coming back to a different question:
What if we could simply ask, “Why did my AWS cost increase?”
Not just which service became more expensive, but an evidence-backed explanation of what probably caused it.
I started thinking about an AWS Cost Detective as a four-stage flow:
Detect → Attribute → Correlate → Explain

1. Detect

Start with Cost Explorer and Cost Anomaly Detection to identify the financial signal and narrow it by service, account, region and usage type.
Instead of “AWS cost increased by $250”, we might get:
EC2 → Production → ap-southeast-2 → majority of increase
Cost data isn't real-time, so recent investigations may still be provisional while billing data catches up.

2. Attribute

Next, identify the workload behind the increase.
CUR/Data Exports, resource metadata, tags and Cost Categories could help turn “EC2 increased” into:
Production → Checkout → EC2
This is also where things get messy. Tag coverage isn't always perfect, and shared costs such as NAT Gateways, EKS nodes or data transfer don't always map neatly to one workload. A trustworthy detective should be comfortable saying “unattributed” rather than forcing an answer.

3. Correlate

This is the interesting part. Once we know where cost changed, what happened around the same time?
Could we correlate it with:
  • Auto Scaling activity
  • CloudWatch traffic/utilisation
  • CloudTrail changes
  • AWS Config history
  • deployments or new resources
  • Savings Plans/RI coverage or effective-rate changes
The correlation key could be something like:
Account + Region + Workload/Resource + Time
For example, EC2 cost increased, checkout scaled out, and request volume increased during the same period.
That doesn't prove causation. A better output might be several ranked hypotheses with confidence rather than one definitive root cause.

4. Explain

Before involving generative AI, I would build an evidence package containing the cost delta, workload, time window, resource changes and operational signals.
Then a generative layer could explain the evidence rather than guess the cause:
Production EC2 spend increased alongside additional checkout capacity and higher request volume. These signals explain most of the observed increase.
Every explanation should link back to its evidence.
Interestingly, AWS is already moving toward this experience with AI-assisted cost investigation capabilities. That makes the remaining question even more interesting.
How far could we take the correlation layer?
Could we combine financial signals with CloudTrail, CloudWatch, Config, scaling, deployment and commitment data to understand not only what changed in the AWS account, but what changed in the workload itself?
I could imagine this eventually becoming event-driven:
Cost anomaly → investigation workflow → collect evidence → correlate signals → generate explanation
For me, the key principle is simple:
Cost data tells us what changed. Operational data tells us what happened. AI should explain the evidence — not invent it.
What other signals would you add to a Cost Detective?
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article