Catching AWS Cost Spikes Before the Invoice
The bill arrives weeks late. By then a runaway logging pipeline has already burned thousands. Here is how to catch spikes in hours, not weeks.
Key takeaways
- Turn on AWS Cost Anomaly Detection with a services monitor and an individual-alert subscription to an SNS topic, filtered by an absolute dollar threshold.
- Add AWS Budgets with forecast alerts per environment, then enforce cost allocation tags so every alert names an owner.
- Expect alerts within about 24 hours of a spike, not on the invoice.
On this page
To catch AWS cost spikes before the invoice, enable Cost Anomaly Detection with an IMMEDIATE SNS subscription and a dollar threshold such as $100, add AWS Budgets forecast alerts per environment, and enforce cost allocation tags. Detection runs about three times a day, so a spike reaches a human within roughly 24 hours, not weeks.
Verified against
AWS CLI 2.39 ce command reference, AWS Cost Anomaly Detection and AWS Budgets user guides, AWS Budgets pricing, against docs.aws.amazon.com and aws.amazon.com. Checked October 2026.
An AWS bill is a report of history. If finance closes the month on the 5th, a spike that starts on the 8th sits invisible for nearly a month before anyone with authority sees a number. That is weeks of a misconfigured NAT gateway, a debug log level left on in production, or a forgotten load test hammering an endpoint. A single service shipping DEBUG logs to CloudWatch can quietly cost thousands of dollars before a monthly review catches it.
The fix is near-real-time visibility, wired to alerts that reach a human within hours. Here is the setup we'd run.
Cost Anomaly Detection does the boring math for you
AWS Cost Anomaly Detection uses machine learning models to learn your normal spend pattern, including weekly and monthly seasonality, and flags deviations. AWS describes its default setup as coming with no effort or cost. You do not tune statistical thresholds by hand. You create monitors, attach subscriptions, and it emails or messages you when something looks off.
Two timing facts set expectations. Detection runs approximately three times a day on Cost Explorer data, which itself lags by up to 24 hours, so an anomaly can take up to a day to surface. And a new service needs 10 days of usage history before anomalies can be detected for it.
We'd run two monitors. One is the AWS managed services monitor, which evaluates every service the account uses and picks up new services automatically. The other, created in the management account, is an AWS managed linked-account monitor, so a single misbehaving team account shows up on its own. The account-level monitor isolates blame fastest.
Creating a monitor and subscription from the CLI looks like this:
$ aws ce create-anomaly-monitor --anomaly-monitor '{
"MonitorName": "per-service-monitor",
"MonitorType": "DIMENSIONAL",
"MonitorDimension": "SERVICE"
}'
$ aws ce create-anomaly-subscription --anomaly-subscription '{
"SubscriptionName": "cost-spikes-slack",
"MonitorArnList": ["arn:aws:ce::123456789012:anomalymonitor/abc123"],
"Frequency": "IMMEDIATE",
"ThresholdExpression": {
"Dimensions": {
"Key": "ANOMALY_TOTAL_IMPACT_ABSOLUTE",
"MatchOptions": ["GREATER_THAN_OR_EQUAL"],
"Values": ["100"]
}
},
"Subscribers": [
{"Type": "SNS", "Address": "arn:aws:sns:us-east-1:123456789012:cost-alerts"}
]
}'
Use IMMEDIATE frequency (individual alerts, which require SNS) with an absolute-impact threshold rather than daily or weekly email digests. A digest that lands at midnight UTC is a digest nobody reads before lunch. Use ThresholdExpression, not the older Threshold field, which the CLI reference marks as deprecated. Route the SNS topic to Slack through Amazon Q Developer in chat applications (the service formerly called AWS Chatbot) so the alert lands where the on-call engineer already lives. The $100 threshold filters out noise; a $12 blip on a $400k account is not worth a ping.
Budgets are the hard stop, with actions
Anomaly detection tells you something changed. Budgets tell you that you crossed a line you drew on purpose, and Budgets can pull a trigger. We'd set monthly budgets per environment and per major service, alerting at 80% and 100% of forecast. The 80% alert is a warning. The 100% one, for non-production accounts, can attach a budget action that applies an IAM policy or SCP, or stops specific EC2 or RDS instances. As of October 2026, budget monitoring is free, the first two action-enabled budgets are free, and each additional one costs $0.10 per day.
A budget with a forecasted-spend alert:
{
"BudgetName": "staging-monthly",
"BudgetLimit": { "Amount": "5000", "Unit": "USD" },
"TimeUnit": "MONTHLY",
"BudgetType": "COST",
"CostFilters": { "TagKeyValue": ["user:env$staging"] },
"NotificationsWithSubscribers": [
{
"Notification": {
"NotificationType": "FORECASTED",
"ComparisonOperator": "GREATER_THAN",
"Threshold": 100,
"ThresholdType": "PERCENTAGE"
},
"Subscribers": [
{"SubscriptionType": "SNS", "Address": "arn:aws:sns:us-east-1:123456789012:cost-alerts"}
]
}
]
}
We would not wire automated shutdown actions to production. Killing a prod service to save money is a worse outage than the overspend. In staging and sandbox accounts, though, an action that stops idle instances at the budget ceiling is cheap insurance against a load test that never turned itself off.
Tags are the difference between an alert and an answer
An anomaly alert that says "EC2 spend is up $2,000" is a starting point, not an answer. What you want is "the payments team's staging fleet is up $2,000." That only works if every resource carries the tags to attribute it, and if those tags are actually enforced.
Standardize on a handful of allocation tags, for example team, env, service, and cost-center. Then make them non-optional with a tag policy in the organization and an SCP that denies resource creation for the expensive services when the tags are missing:
{
"Effect": "Deny",
"Action": ["ec2:RunInstances", "rds:CreateDBInstance"],
"Resource": "*",
"Condition": {
"Null": {
"aws:RequestTag/team": "true"
}
}
}
Enforcement is the part everyone skips and then regrets. Untagged resources drift into an "unallocated" bucket that grows until it is the biggest line item and nobody can explain it. Activate the tags as cost allocation tags in the billing console. AWS says new tag keys can take up to 24 hours to appear for activation and up to another 24 hours to activate, so plan for two days. Then audit the unallocated bucket weekly until it is close to zero.
Attribution: CUR and Cost Explorer
Once tags flow, Cost Explorer is enough for most investigations. Group by service, filter by the tag the alert named, use daily granularity, and the spike shows up as a step change on a specific day.
For the rest, the Cost and Usage Report is the ground truth. It is the line-item, hourly dataset behind every chart, delivered to S3 and queryable with Athena. When a data transfer charge appears with no obvious owner, CUR's line_item_usage_type column tells you it was, say, cross-AZ traffic, which points at a chatty service crossing availability zones for no reason.
The usual suspects
Most spikes fall into one of four buckets. Runaway logging, where a log level or a retry storm floods CloudWatch or ships terabytes to a SIEM. A forgotten environment, usually a load-test or demo account left running over a weekend. Data transfer, the sneakiest one, from cross-AZ or NAT gateway traffic that never shows up in a compute dashboard (NAT gateway costs covers that line item). And a brand-new service whose defaults are expensive, like provisioned concurrency or a large OpenSearch cluster someone spun up "just to try."
Knowing the four buckets keeps the triage runbook short. Check logging volume, check for accounts that should be idle, check data transfer by usage type, check what launched in the last 48 hours. If an alert has already fired, the first-hour AWS bill spike runbook walks through it step by step.
Instrument before you optimize
The tempting move when finance asks about cloud spend is to jump straight to Reserved Instances and rightsizing. That is backwards. You cannot rightsize what you cannot attribute, and a Savings Plan on top of a runaway workload just locks in the waste. Get the monitors, budgets, and tags in place first so every dollar has an owner and every spike has an alarm. Then the deeper cloud cost optimization work has real numbers to act on instead of guesses.
Questions people ask
How fast does AWS Cost Anomaly Detection alert?
Not instantly. It runs about three times a day on Cost Explorer data that can lag by up to 24 hours, so expect an alert within roughly a day of the spend starting. A brand-new monitor needs up to 24 hours before it begins detecting, and a new service needs 10 days of history. For anything faster, alarm on usage metrics in CloudWatch, not on billing data.
Is AWS Cost Anomaly Detection free?
None of the AWS pages cited here list a separate charge for Cost Anomaly Detection itself, so confirm on your first bill. AWS Budgets monitoring with alerts is free of charge. Budget actions are where charges start: as of October 2026 the first two action-enabled budgets are free and each additional one costs $0.10 per day. Cost Explorer API calls and CUR queries in Athena are billed separately.
What is the difference between AWS Budgets and Cost Anomaly Detection?
Budgets compare spend or forecast against a fixed number you choose and can run actions such as applying an IAM policy or stopping instances. Cost Anomaly Detection learns your normal spend pattern and alerts on deviations without a fixed number. Use both: anomaly detection catches the unexpected spike, Budgets enforce the ceiling.
The call we'd make
Turn on Cost Anomaly Detection today. It costs nothing in its default setup, takes about twenty minutes, and is the single most useful thing you can do about a cost anomaly before the invoice arrives. Add per-environment Budgets with SNS alerts this week, and spend the next sprint making allocation tags non-optional. Skip the automated shutdown actions on production; the outage costs more than the overspend. Everything after that is optimization, and optimization only works once you can name where the money goes.
Sources
Cite this article
Kiril Urbonas (2026). Catching AWS Cost Spikes Before the Invoice. DevOpsNess. Updated 2026-10-31. https://www.devopsness.com/blog/aws-cost-anomaly-detection
[Catching AWS Cost Spikes Before the Invoice](https://www.devopsness.com/blog/aws-cost-anomaly-detection) (Kiril Urbonas, DevOpsNess, updated 2026-10-31)
More from Cloud
Explore more articles in this category
.NET 8 Support Ends November 10: The Lambda and Azure Functions Checklist
.NET 8, .NET 9, the Lambda dotnet8 runtime and the Azure Functions in-process model all lose support on November 10, 2026. Inventory commands, the isolated-worker migration and a CI gate.
Google Cloud's europe-west2 Outage: One Zone Lost Power and the Region Stalled for 6 Hours
On October 20, 2026, europe-west2-b lost power when its generators never started. Cross-zone control-plane timeouts then degraded the whole London region. What happened and the gcloud audit to run now.
Lambda Python 3.10 Is Deprecated Today: Find Every Function and Move to 3.13
AWS deprecated the Lambda python3.10 runtime on October 31, 2026. Functions keep running, patches stop. The inventory commands, IaC diffs and AL2023 gotchas for moving to python3.13.
You might have missed
Evergreen posts worth revisiting.