Creating Alarms and Notifications
Trigger SNS alerts when a security threshold is crossed.
Creating Alarms and Notifications is a free AWS Security Academy lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the AWS Security Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
What a CloudWatch Alarm Does
A CloudWatch alarm watches a single metric and changes state when the value crosses a threshold you define over a period of time. Its job is to convert a number that breaches a limit into an action, most often a notification. Alarms are how monitoring becomes alerting.
The Three Alarm States
An alarm is always in one of three states: OK when the metric is within bounds, ALARM when the threshold is breached, and INSUFFICIENT_DATA when there is not enough data to decide. Actions can be attached to any state transition, so you can notify both when trouble starts and when it clears.
Thresholds and Evaluation
You configure the statistic (such as Sum or Average), the period (the length of each data window), and the number of evaluation periods that must breach before the alarm fires. Requiring several consecutive bad periods reduces false alarms from brief spikes, while a single period gives the fastest possible alert.
Amazon SNS as the Messenger
Alarms do not send email themselves. They publish to Amazon SNS (Simple Notification Service), a pub/sub service. An SNS topic has subscribers such as email addresses, SMS numbers, or Lambda functions. The alarm notifies the topic, and SNS fans the message out to everyone subscribed.
aws cloudwatch put-metric-alarm \
--alarm-name RootAccountUsage \
--metric-name RootUsageCount --namespace Security \
--statistic Sum --period 300 --threshold 1 \
--comparison-operator GreaterThanOrEqualToThreshold \
--evaluation-periods 1 \
--alarm-actions arn:aws:sns:us-east-1:111122223333:sec-alertsTriggering Automation
Notification is not the only action. An alarm can invoke an EC2 action, an Auto Scaling action, or, through SNS or EventBridge, a Lambda function. This lets a security alarm do more than page someone: it can kick off an automated containment workflow the instant a threshold is crossed.
Composite Alarms
A composite alarm combines several alarms using AND/OR logic into one parent. This cuts alarm noise: instead of three separate pages, you fire once only when a meaningful combination is true. It is useful for reducing alert fatigue while still keeping each underlying alarm available for detail.
Securing SNS Topics
The SNS topic is part of your alert chain, so protect it. Use a topic access policy to control who can publish and subscribe, and consider server-side encryption with KMS for sensitive alert content. An attacker who can subscribe to your alert topic learns exactly what you are watching for.
Anomaly Detection Alarms
Instead of a fixed threshold, an alarm can use CloudWatch anomaly detection, which learns a metric's normal range and alerts on deviations from a band. This suits metrics with daily or weekly patterns where a static number would either miss problems or fire constantly. It adapts as behavior shifts over time.
Missing Data Handling
You decide how an alarm treats missing data: as good, bad, ignored, or as keeping the current state. For security alarms this matters. If your logging stops because an attacker disabled it, treating missing data as "breaching" can turn silence into a signal rather than a blind spot.
Alarm Design for Security
Good security alarms are specific, well tuned, and routed to a channel humans watch. Too many noisy alarms train teams to ignore them. Use few evaluation periods for critical events like root login so the alert is immediate, and pair alarms with automation so the most dangerous events get a response before anyone reads the email.
End-to-End Flow
The full chain is: a log line matched by a metric filter increments a metric, a CloudWatch alarm watches that metric, and on breach it notifies an SNS topic that pages your team and optionally triggers Lambda. Mastering this flow is essential for the logging and monitoring domain of the exam.
Quick Check
Test your alarm knowledge.
Recap
A CloudWatch alarm watches one metric and moves between OK, ALARM, and INSUFFICIENT_DATA based on a threshold over evaluation periods. On breach it publishes to an SNS topic that fans out to subscribers or triggers automation. Composite alarms cut noise, anomaly detection adapts to patterns, and careful missing-data handling turns logging gaps into signals.
Frequently asked questions
Is the “Creating Alarms and Notifications” lesson free?
Yes — the full text of “Creating Alarms and Notifications” is free to read here on the web, and the AWS Security Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the AWS Security Academy course, upgrade to CoddyKit PRO.
What will I learn in “Creating Alarms and Notifications”?
Trigger SNS alerts when a security threshold is crossed. You practise AWS Security Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start AWS Security Academy?
No prior experience is required. AWS Security Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Creating Alarms and Notifications” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this AWS Security Academy lesson?
Yes. Every AWS Security Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Collecting Logs into CloudWatch
- Metric Filters for Security Events
- Creating Alarms and Notifications
- Detecting Root Account Usage