AWS Cost Anomaly Detection

A service that uses machine learning to automatically detect unusual cost fluctuations, providing root cause analysis and alert notifications

Overview

AWS Cost Anomaly Detection is a service that continuously monitors AWS spending using machine learning models, automatically detecting abnormal expenditures that deviate from normal patterns. Provided as a feature of AWS Cost Explorer at no additional charge, it lets you configure monitors by service, account, cost allocation tag, or cost category. When anomalies are detected, you receive immediate alerts via SNS, Amazon Chime, or email. Each detected anomaly includes root cause analysis with service name, region, and usage type, enabling rapid identification of cost spike origins.

Monitor Types and Alert Subscriptions

Cost Anomaly Detection monitors define the unit of cost data surveillance. There are four types: service monitors that watch individual AWS services, account monitors that track linked accounts, tag monitors that observe cost allocation tags, and cost category monitors. Service monitors are the simplest to set up, individually monitoring all services within an AWS account and detecting cost spikes for specific services. In multi-account environments, account monitors are effective, enabling centralized anomaly monitoring across member accounts from the Organizations management account. Alert subscriptions are attached to monitors and can filter by anomaly impact amount or percentage thresholds. For example, setting a threshold of "only notify for anomalies with impact above $100" prevents alert fatigue from minor fluctuations. Notification destinations include SNS topics, email addresses, and Amazon Chime webhooks, with Slack integration achievable through AWS Chatbot via SNS.

ML Model Training and Detection Accuracy

Cost Anomaly Detection's machine learning model automatically learns spending patterns for each service and account from historical cost data. Detection begins after a minimum of 24 hours of data accumulation following monitor creation, but approximately two weeks of training are needed for accuracy to stabilize. The model recognizes patterns such as day-of-week periodicity, regular spikes from month-end batch processing, and seasonal traffic fluctuations, adjusting to avoid flagging these predictable variations as anomalies. Detection granularity is daily, with anomaly determination based on the previous day's cost data. Since it is not real-time detection, pairing it with CloudWatch billing metric alarms is recommended for immediate detection of short-duration spikes lasting only a few hours. To improve detection accuracy, properly configuring cost allocation tags to increase monitor granularity is effective. When many resources lack tags, multiple factors blend together and degrade the model's learning accuracy. For a broader understanding of cloud cost optimization strategies, related books (Amazon) provide useful frameworks.

Root Cause Analysis and Response Workflow

When an anomaly is detected, Cost Anomaly Detection automatically performs root cause analysis. The analysis results include the service name, region, account, and usage type (e.g., USW2-BoxUsage:m5.xlarge) that caused the anomaly, pinpointing the specific source of the cost increase. The anomaly detail view displays a graph comparing the expected cost forecast against actual costs, providing a visual representation of the deviation's magnitude. A practical response workflow starts with reviewing the cost breakdown for the relevant period in Cost Explorer, narrowing down to the service and region indicated by the root cause analysis. Next, investigate CloudTrail API calls during that period to check for unintended resource creation or scaling events. Common causes include forgotten test environment resources, Auto Scaling upper limit misconfigurations, unexpected data transfer volume increases, and Reserved Instance expirations. Submitting feedback (true positive or false positive) on confirmed anomalies continuously improves the model's accuracy.

共有するXB!