AWS CloudWatch

Anatomy of Alarms

Alarm Anatomy

In this lesson, we’ll dissect the components of a CloudWatch alarm, explore best practices for setting thresholds, and walk through an example of monitoring an RDS instance.

Core Components of a CloudWatch Alarm

ComponentDescription
Alarm NameA concise, unique identifier to locate and manage your alarm efficiently.
MetricThe AWS metric (e.g., CPUUtilization) you want to monitor.
StatisticAggregation method: Average, Minimum, Maximum, Sum, or SampleCount.
ThresholdNumerical value that triggers the alarm when crossed.
PeriodEvaluation interval in seconds (e.g., 60, 300, 900).
Evaluation PeriodsNumber of consecutive periods the threshold must be breached before triggering.
Datapoints to AlarmHow many of those evaluation periods must breach the threshold to fire the alarm.
Comparison OperatorComparison type: GreaterThanThreshold, LessThanOrEqualToThreshold, etc.
Alarm ActionsActions on state change: SNS notification, Lambda invocation, Auto Scaling, etc.

The image is a diagram titled "Alarm Anatomy in AWS CloudWatch," showing components like Alarm Name, Metric, Statistic, Threshold, Period, Evaluation Periods, Datapoints to Alarm, Comparison Operator, and Alarm Actions.


Example: Creating an Alarm for RDS CPU Utilization

Apply these settings to keep tabs on an Amazon RDS instance’s CPU usage:

aws cloudwatch put-metric-alarm \
  --alarm-name "High-CPU-RDS" \
  --metric-name CPUUtilization \
  --namespace AWS/RDS \
  --statistic Average \
  --period 900 \
  --threshold 90 \
  --comparison-operator GreaterThanThreshold \
  --evaluation-periods 1 \
  --datapoints-to-alarm 1 \
  --dimensions Name=DBInstanceIdentifier,Value=mydbinstance \
  --alarm-actions arn:aws:sns:us-east-1:123456789012:DefaultCloudWatchAlarms

The image is a diagram explaining the conditions for setting an alarm in AWS CloudWatch, focusing on threshold types and CPU utilization criteria. It includes options for static and anomaly detection thresholds, and conditions like greater, greater/equal, lower/equal, and lower.

Note

Consider using anomaly detection thresholds for dynamic baselines instead of static thresholds.

Warning

Avoid setting low thresholds with short evaluation periods—this can generate noise from transient spikes. Tune EvaluationPeriods and DatapointsToAlarm for stability.


Notification Settings

Define how CloudWatch alerts you when the alarm state changes:

SettingDescription
Alarm StateTriggers when the alarm enters ALARM state.
NotificationDelivery via an Amazon SNS topic.
SNS Topice.g., DefaultCloudWatchAlarms or a custom topic.
EndpointEmail address, Lambda function ARN, or HTTP webhook.

The image is a diagram explaining the notification settings for an alarm in AWS CloudWatch, detailing alarm state triggers and SNS topic selection. It includes options for defining alarm states and creating or selecting SNS topics for notifications.


Watch Video

Watch video content

Previous
Metric Granularity and Aggregation