Sub topic 11
Detecting cost anomalies early
This chapter assumes you can run AWS CLI commands, read JSON, and have seen Cost Explorer and budgets from earlier chapters. A budget tells you when spend passes a fixed line. An anomaly detector tells you when spend departs from its normal pattern, even if the total is still under budget.
Why budgets are not enough
A budget of 1000 USD per month fires at 800 USD. If a misconfigured job starts burning 150 USD per day on the 3rd, you learn about it around the 8th. If your normal spend is 20 USD per day, a jump to 60 USD per day never crosses the budget until much later, so no alert fires for weeks.
Anomaly detection compares each day's spend with a baseline learned from your history. It flags spend that is unusual for that service, account, or tag, whatever the absolute amount.
How AWS Cost Anomaly Detection works
AWS Cost Anomaly Detection uses machine learning on your billing data. It has two parts:
- A monitor defines what to watch. Common types are per AWS service, per member account, per cost allocation tag, and per cost category.
- A subscription defines who is told and how. It sets an alert threshold and a frequency (individual alerts, daily summary, or weekly summary).
Detection is not instant. Billing data arrives with a delay, often up to about a day, so expect alerts within roughly a day of the spend, not within minutes.
Create a monitor and a subscription
Create a monitor that watches each AWS service separately:
aws ce create-anomaly-monitor \
--anomaly-monitor '{"MonitorName":"by-service","MonitorType":"DIMENSIONAL","MonitorDimension":"SERVICE"}'The command returns a MonitorArn. Use it in the subscription. This one sends a daily summary by email when an anomaly's total impact is at least 50 USD:
aws ce create-anomaly-subscription \
--anomaly-subscription '{
"SubscriptionName": "daily-finops",
"MonitorArnList": ["arn:aws:ce::123456789012:anomalymonitor/EXAMPLE-ID"],
"Subscribers": [{"Type":"EMAIL","Address":"[email protected]"}],
"Frequency": "DAILY",
"ThresholdExpression": {
"Dimensions": {
"Key": "ANOMALY_TOTAL_IMPACT_ABSOLUTE",
"MatchOptions": ["GREATER_THAN_OR_EQUAL"],
"Values": ["50"]
}
}
}'Replace the account ID and monitor ID with your own. Email subscribers work with DAILY or WEEKLY frequency. Use an SNS topic subscriber when you need IMMEDIATE alerts, for example to feed chat or a ticket system.
Review what was found
List anomalies from the last week:
aws ce get-anomalies \
--date-interval StartDate=2026-11-19,EndDate=2026-11-26Each result includes the service, the account, a root cause estimate, and the impact in dollars. Start with the root cause, then open Cost Explorer for the same service and day to confirm.
Tune the thresholds
- A threshold that is too low floods owners with alerts, and they stop reading them.
- A threshold that is too high hides slow leaks.
- Start at a value that is meaningful for your bill, such as 1 to 5 percent of monthly spend, then adjust after a few weeks.
- Use a tag-based or cost-category monitor so alerts go to the team that owns the spend. This builds on the tagging chapter.
Common errors
- Expecting alerts on day one. A new monitor needs history to learn a baseline, so early results can be sparse or noisy.
- One monitor for everything. An account-wide monitor can hide a spike in a small service. Add per-service or per-tag monitors.
- Alerts with no owner. An email to a shared inbox that nobody triages is the same as no alert. Name a person or rotation.
- Treating legitimate growth as a problem. A product launch will trigger alerts. Record the cause and move on.
Exercise
Your monthly budget is 5000 USD with an alert at 80 percent. A service normally costs 30 USD per day and jumps to 200 USD per day on the 2nd. Why might the budget alert fail to warn you early, and what would you configure to catch it?
Show answer
The budget alert only fires when actual spend reaches 4000 USD, and at 200 USD per day plus normal costs that is not reached until much later in the month. An anomaly monitor for that service (type DIMENSIONAL, dimension SERVICE) with a subscription threshold such as 50 USD total impact would flag the jump within about a day, because it compares spend with the service's own baseline.
Exercise
Which subscription frequency do you need if you want an anomaly alert delivered to a chat tool in near real time, and which subscriber type supports it?
Show answer
Use IMMEDIATE frequency with an SNS topic subscriber. Email subscribers only support DAILY or WEEKLY summaries.