Cost Anomaly Detection
π§ What Is AWS Cost Anomaly Detection?¶
AWS Cost Anomaly Detection is a machine learningβbased service that continuously monitors your AWS cost and usage data and automatically detects anomalies (sudden spikes or drops) at the service, account, or tag level.
β It helps you proactively catch billing surprises, such as unintended usage, configuration errors, or cost increases.
π Why Use It?¶
| Purpose | Benefit |
|---|---|
| π§ Early Detection | Find unexpected cost spikes before monthly invoice |
| π¬ Automatic Notifications | Alert you via email or SNS on anomaly detection |
| π― Granular Control | Detect anomalies by service, account, or cost center |
| π Daily Monitoring | Automatic, no manual querying |
| π Visualizations | Integrated with Cost Explorer and Budgets |
π§± Core Components¶
| Component | Description |
|---|---|
| Monitor | Defines the scope of anomaly detection (e.g., by linked account, service) |
| Threshold | Defines what qualifies as an anomaly (based on historical baseline) |
| Subscription | Defines who gets notified (via email or SNS) |
| Linked Accounts | Detect anomalies per account (useful for AWS Organizations) |
π― Supported Dimensions for Monitors¶
You can create a monitor by:
-
Service (e.g., EC2, S3, Lambda)
-
Linked Account (if using AWS Organizations)
-
Linked Account + Service
-
Tag (e.g., Project, Environment)
π§ How It Works (Workflow)¶
-
π ML model is trained on past 5 weeks of cost/usage data
-
π¨ When usage deviates from normal, an anomaly is flagged
-
π¬ You receive an email/SNS alert with anomaly details
-
π Investigate the anomaly in the AWS Console or Cost Explorer
π₯οΈ Setting It Up (Console Steps)¶
-
Go to AWS Cost Anomaly Detection in the console
-
Click βCreate monitorβ
-
Choose:
-
Monitor type (Service, Linked Account, etc.)
-
Name
-
-
Create a subscription:
- Add email addresses or SNS topics for alerts
-
Review and create
π¬ Example: Email Alert from Anomaly¶
Youβll receive something like:
Subject: [Anomaly Detected] EC2 cost for Dev account increased by 260%
Details:
Service: AmazonEC2
Timeframe: June 10 β June 11
Expected Cost: $1.25
Actual Cost: $4.50
π¦ Terraform (Not yet officially supported directly)¶
Cost Anomaly Detection does not yet have native Terraform resource support as of 2025, but you can use the AWS SDK or CloudFormation custom resources as a workaround.
π° Pricing¶
| Feature | Cost |
|---|---|
| Creating Monitors | β Free |
| Receiving Alerts (Email/SNS) | β Free |
| Underlying ML Engine | β Free |
β AWS Cost Anomaly Detection is entirely free to use.
β TL;DR Summary¶
| Feature | AWS Cost Anomaly Detection |
|---|---|
| Goal | Detect and alert on unexpected AWS cost spikes |
| Uses ML? | β Yes (based on 5 weeks of historical data) |
| Delivery Methods | Email, SNS |
| Monitor by | Service, Account, Tag |
| Frequency | Daily check, alerts in near real-time |
| Cost | β Free |
| Terraform Support | β Not yet, but scriptable via SDK |