|« PreviousNext »|
|Did this page help you? Yes | No | Tell us about it...|
You can create an Amazon CloudWatch alarm that sends an Amazon Simple Notification Service message when the alarm changes state. An alarm watches a single metric over a time period you specify, and performs one or more actions based on the value of the metric relative to a given threshold over a number of time periods. The action is a notification sent to an Amazon SNS topic or Auto Scaling policy. Alarms invoke actions for sustained state changes only. Amazon CloudWatch alarms will not invoke actions simply because they are in a particular state, the state must have changed and been maintained for a specified number of periods.
After an alarm invokes an action due to a change in state, its subsequent behavior depends on the type of action that you have associated with the alarm. For Auto Scaling policy notifications, the alarm continues to invoke the action for every period that the alarm remains in the new state. For Amazon SNS notifications, no additional actions are invoked.
An alarm has three possible states:
OK—The metric is within the defined threshold
ALARM—The metric is outside of the defined
INSUFFICIENT_DATA—The alarm has just started, the metric is not
available, or not enough data is available for the metric to determine the alarm
In the following figure, the alarm threshold is set to 3 and the minimum breach is 3 periods.
That is, the alarm invokes its action only when the threshold is breached for 3 consecutive periods.
In the figure, this happens with the third through fifth time periods,
and the alarm's state is set to
ALARM. At period six, the value dips below the
threshold, and the state reverts to
OK. Later, during the ninth time period,
the threshold is breached again, but not for the necessary three consecutive periods.
Consequently, the alarm's state remains
Amazon CloudWatch doesn't test or validate the actions you specify, nor does it detect any Auto Scaling or SNS errors resulting from an attempt to invoke nonexistent actions. Make sure your actions exist.
Common Features of Alarms
You can create up to 5000 alarms per AWS account. To create or update an alarm, you use
PutMetricAlarm API function (
You can list any or all of the currently configured alarms, and list any alarms in a
particular state using the
DescribeAlarms API (
mon-describe-alarms command). You can further filter the list by time
You can disable and enable alarms by using the
You can test an alarm by setting it to any state using the
SetAlarmState API (
mon-set-alarm-state command). This
temporary state change lasts only until the next alarm comparison occurs.
Finally, you can view an alarm's history using the
DescribeAlarmHistory API (
command). Amazon CloudWatch preserves alarm history for two weeks. Each state transition is
marked with a unique time stamp. In rare cases, your history might show more than one
notification for a state change. The time stamp enables you to confirm unique state