MORTIMERDEV LABS / AWS / CLOUDWATCH ALARMS FREE · BETA

Build a CloudWatch alarm.
And see when it would fire.

Pick a preset or describe your own metric, and get the alarm in plain English, the mistakes to fix (the wrong statistic, sparse metrics stuck in INSUFFICIENT_DATA, periods CloudWatch won’t accept), a test run on sample data using CloudWatch’s own missing-data rules, and CDK in TypeScript and Python.

Runs in your browser. Nothing is stored or sent.
Take the 10-question alarms quiz

Build an alarm

Metric
Condition
Name and notification

YOUR ALARM

As CDK

TypeScript

Python

Test it on sample data

Uses CloudWatch’s documented rules: the most recent real points decide when there are enough; otherwise gaps are filled using your missing-data setting.

Period Value Breaching? Alarm state

See it in AWS

Once it’s deployed: where to find the alarm, how to check its state from the CLI, and what each state means.

In the console

    From the CLI

    Uses the names you entered above. Run with credentials for the right account and region.

    What is a CloudWatch alarm?

    A CloudWatch alarm watches one metric (or a calculation on metrics) and changes state when it crosses a threshold: OK, ALARM, or INSUFFICIENT_DATA when there isn’t enough data. On each change it can notify people through SNS, scale a service, or trigger other automation. It’s the building block for SLO burn-rate alerts too.

    Sum of Errors > 0 in 3 of 5 1-minute periods → SNS
    Metric + statistic
    What’s measured, and how each period is summed up
    Threshold
    The comparison each data point is checked against
    M of N
    How many recent periods must breach
    Period
    How long each data point covers
    Action
    Who hears about it when the state changes

    Where you’ll use them

    • Errors and throttles on Lambda, API Gateway, load balancers and DynamoDB.
    • Latency with a p99 or p95 statistic, so slow outliers aren’t averaged away.
    • Backlogs like the age of the oldest SQS message.
    • Real users, with CloudWatch RUM metrics like JavaScript errors and Largest Contentful Paint.

    Easy to confuse

    • INSUFFICIENT_DATA isn’t OK: it often means the metric or its dimensions are wrong, or the metric only appears when something happens.
    • Evaluation periods aren’t a delay: with 3 of 5, it can alarm after 3 bad periods, not 5.
    • An alarm with no action changes colour in the console and tells nobody.

    TEST YOURSELF

    How well do you know CloudWatch alarms?

    Ten questions on statistics, periods, M of N and missing data, with an explanation and a link to the reference after each one. Three are “what state is the alarm in?” questions worked out with CloudWatch’s rules.

    CLOUDWATCH ALARMS REFERENCE

    CloudWatch alarms, in plain English.

    Basics

    Alarm statesOK, ALARM or INSUFFICIENT_DATA. Actions run when the state changes.

    INSUFFICIENT_DATA appears just after an alarm is created, when the metric isn’t being published, or when there’s too little data and missing data is treated as missing. You can attach actions to all three states, for example notify on ALARM and again on OK.

    Namespace, metric and dimensionsA metric is a namespace (AWS/Lambda), a name (Errors) and dimensions (FunctionName=resize-images).

    Dimensions must match exactly what the service publishes, including case. A metric with different dimensions is a different metric, so an alarm with a typo silently watches nothing and sits in INSUFFICIENT_DATA.

    StatisticHow data in each period is combined: Sum for counts, a percentile (p99) or Average for timings, Maximum or Minimum for levels.

    Sum of Errors answers “how many errors?”. p99 of Latency answers “how slow are the slowest 1% of requests?”. Average hides spikes, and Sum of a latency means nothing.

    Evaluation

    PeriodThe length of each data point, in seconds: 60 or a multiple of 60, or 10, 20 or 30 for high-resolution alarms.

    Alarms with periods of a minute or more are evaluated every minute on a sliding window. High-resolution periods are evaluated every 10 seconds, cost more, and need high-resolution custom metrics. Many AWS metrics are per minute; EC2 basic monitoring is every 5 minutes.

    Evaluation periods and datapoints to alarmN is how many recent periods are looked at; M is how many of them must breach. 3 of 5 means any 3 of the last 5.

    M = N needs every period to breach, which is slow but calm. M < N tolerates the odd good period, which catches flapping problems without alarming on one spike. The fastest an alarm can fire is M × period after a problem starts.

    Threshold and comparisonEach data point is compared with the threshold: greater than, at least, less than or at most.

    “Greater than 0” is the usual way to say “any errors”; “at least 0” is always true. Anomaly detection alarms compare against a learned band instead of a fixed number.

    Multi-day alarmsIf evaluation periods × period is more than a day, the alarm is evaluated once an hour.

    Useful for slow trends like daily totals, but they react slowly by design.

    Missing data

    Treat missing datamissing (default), notBreaching, breaching or ignore: what to do when there aren’t enough data points.

    notBreaching suits error counts that are only published when something happens. breaching suits heartbeats, where silence is the problem. ignore keeps the current state. missing goes to INSUFFICIENT_DATA when there’s no data at all. Alarms on AWS/DynamoDB metrics default to ignore.

    How gaps are handledCloudWatch looks a little further back than N to find real data, and only fills gaps when it can’t.

    If it finds at least N real points, it uses the most recent N and ignores the setting. Otherwise it fills as few missing points as possible using the setting. With missing, an alarm can still fire early if the oldest breaching point is old enough and nothing newer is fine.

    Sparse metricsSome metrics only appear when something happens, like Lambda Errors when the function runs.

    An alarm on a sparse metric with treat missing data = missing spends quiet periods in INSUFFICIENT_DATA, which hides real problems among noise. Use notBreaching, or alarm on a metric that’s always published.

    Practice

    Alarm actionsUsually an SNS topic, which can email, post to chat or page someone. Auto Scaling and EC2 actions are also possible.

    In CDK: alarm.addAlarmAction(new SnsAction(topic)). Add an OK action too, so people know when it has recovered.

    Composite alarmsCombine alarms with AND, OR and NOT to cut noise, like paging only when errors and latency are both bad.

    In CDK: new cloudwatch.CompositeAlarm with AlarmRule.allOf / anyOf. The child alarms can then have no actions of their own.

    CostEach alarm has a small monthly charge; high-resolution and anomaly detection alarms cost more.

    Check the CloudWatch pricing page for your Region. Delete alarms for resources you’ve removed.

    Built from AWS’s own rules.

    The test run follows CloudWatch’s documented missing-data behaviour, and the tests check it against AWS’s example tables. CloudWatch looks back a variable number of periods; this uses N + 2, as in AWS’s examples.

    Nothing leaves this page.

    Everything is worked out in your browser and nothing is saved. We count anonymous page views and button use, never what you enter.