Bird
Raised Fist0
AWScloud~10 mins

CloudWatch alarms in AWS - Step-by-Step Execution

Choose your learning style10 modes available
Process Flow - CloudWatch alarms
Metric data collected
↓
Evaluate metric against threshold
↓
Threshold met
↓
Trigger actions
↓
Wait for next evaluation
CloudWatch alarms watch metrics and compare them to a set limit. If the metric crosses the limit, the alarm changes state and can trigger actions.
Execution Sample
AWS
Metric: CPUUtilization
Threshold: 70
Period: 1 min
Evaluate every 1 min
Alarm action: Send notification
This alarm checks CPU usage every minute. If CPU usage goes above 70%, it triggers a notification.
Process Table
StepMetric Value (%)Condition (Value > 70?)Alarm StateAction Taken
165NoOKNo action
272YesALARMSend notification
375YesALARMNo action
468NoOKNo action
569NoOKNo action
671YesALARMSend notification
💡 Alarm evaluates metric every minute; stops when monitoring ends or alarm deleted.
Status Tracker
VariableStartAfter 1After 2After 3After 4After 5After 6
Metric Value (%)N/A657275686971
Alarm StateOKOKALARMALARMOKOKALARM
Action TakenNoneNoneNotification sentNoneNoneNoneNotification sent
Key Moments - 3 Insights
Why does the alarm state change back to OK after being ALARM?
Because the metric value dropped below the threshold (see step 4 in execution_table), the alarm returns to OK state.
Does the alarm send notifications every time the metric is above threshold?
No, only when the alarm transitions to the ALARM state (steps 2 and 6). In step 3, the metric is still above threshold but the state was already ALARM, so no action is triggered.
What happens if the metric value equals the threshold exactly?
The alarm triggers only if the value is greater than the threshold, not equal. So equal values keep alarm state OK.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the alarm state at step 5?
AOK
BALARM
CINSUFFICIENT_DATA
DUNKNOWN
💡 Hint
Check the 'Alarm State' column for step 5 in the execution_table.
At which step does the alarm first send a notification?
AStep 1
BStep 2
CStep 4
DStep 5
💡 Hint
Look at the 'Action Taken' column to find when 'Send notification' first appears.
If the threshold was changed to 65%, what would be the alarm state at step 1?
AOK
BINSUFFICIENT_DATA
CALARM
DUNKNOWN
💡 Hint
Compare the metric value at step 1 with the new threshold in the variable_tracker.
Concept Snapshot
CloudWatch alarms watch a metric over time.
They compare metric values to a threshold.
If metric > threshold, alarm state becomes ALARM.
Alarm can trigger actions like notifications.
Alarm state returns to OK if metric falls below threshold.
Evaluations happen at set intervals.
Full Transcript
CloudWatch alarms monitor metrics like CPU usage. Every evaluation period, the alarm checks if the metric is above a set threshold. If yes, the alarm state changes to ALARM and triggers actions such as notifications. If the metric falls below the threshold, the alarm state returns to OK. This process repeats at each evaluation interval, allowing continuous monitoring and alerting.

Practice

(1/5)
1. What is the primary purpose of an AWS CloudWatch alarm?
easy
A. To store large amounts of log data
B. To monitor a specific metric and notify when it crosses a threshold
C. To create virtual servers in the cloud
D. To manage user permissions and roles

Solution

  1. Step 1: Understand CloudWatch alarm function

    CloudWatch alarms watch metrics like CPU usage or disk space and alert you when values cross set limits.
  2. Step 2: Identify the correct purpose

    Only To monitor a specific metric and notify when it crosses a threshold describes monitoring a metric and notifying on threshold crossing, which is the alarm's job.
  3. Final Answer:

    To monitor a specific metric and notify when it crosses a threshold -> Option B
  4. Quick Check:

    Alarm = Monitor + Notify [OK]
Hint: Alarms watch metrics and alert on changes [OK]
Common Mistakes:
  • Confusing alarms with log storage
  • Thinking alarms create servers
  • Mixing alarms with user management
2. Which of the following is the correct way to specify a CloudWatch alarm threshold for CPU utilization above 80%?
easy
A. "Threshold": "<=80"
B. "Threshold": 80, "ComparisonOperator": "LessThanThreshold"
C. "Threshold": 80, "ComparisonOperator": "LessThanOrEqualToThreshold"
D. "Threshold": 80, "ComparisonOperator": "GreaterThanThreshold"

Solution

  1. Step 1: Understand threshold syntax

    CloudWatch alarms use a numeric Threshold value and a separate ComparisonOperator like GreaterThanThreshold, LessThanThreshold.
  2. Step 2: Choose operator for above 80%

    To alert when CPU is above 80%, use "Threshold": 80, "ComparisonOperator": "GreaterThanThreshold".
  3. Final Answer:

    "Threshold": 80, "ComparisonOperator": "GreaterThanThreshold" -> Option D
  4. Quick Check:

    Above 80% = GreaterThanThreshold(80) [OK]
Hint: Use GreaterThanThreshold for above threshold [OK]
Common Mistakes:
  • Using < instead of > for above threshold
  • Using = which triggers only at exact value
  • Confusing <= with above threshold
3. Given this CloudWatch alarm configuration snippet:
{"MetricName": "CPUUtilization", "Namespace": "AWS/EC2", "Threshold": 70, "ComparisonOperator": "GreaterThanThreshold", "EvaluationPeriods": 3}

What happens if CPU utilization is 75% for 2 consecutive periods and then 65% for the third period?
medium
A. The alarm does not trigger because CPU was not above 70% for all 3 periods
B. The alarm triggers only if CPU is above 70% for 4 periods
C. The alarm triggers immediately when CPU hits 75% the first time
D. The alarm triggers because CPU was above 70% twice

Solution

  1. Step 1: Understand EvaluationPeriods meaning

    The alarm triggers only if the metric breaches the threshold for the specified number of consecutive periods (3 here).
  2. Step 2: Analyze given CPU values

    CPU was above 70% for 2 periods, then dropped below on the 3rd, so the alarm does not trigger.
  3. Final Answer:

    The alarm does not trigger because CPU was not above 70% for all 3 periods -> Option A
  4. Quick Check:

    3 periods breach needed, only 2 met [OK]
Hint: Alarm needs all evaluation periods breached [OK]
Common Mistakes:
  • Thinking alarm triggers after any single breach
  • Ignoring EvaluationPeriods count
  • Assuming alarm triggers immediately
4. You created a CloudWatch alarm but it never enters ALARM state even when the metric crosses the threshold. What is a likely cause?
medium
A. The alarm's EvaluationPeriods is set higher than the number of metric data points
B. The alarm threshold is set too low
C. The alarm is configured to notify but not to monitor metrics
D. The SNS topic ARN configured in alarm actions is invalid

Solution

  1. Step 1: Check EvaluationPeriods vs data points

    If EvaluationPeriods is more than available metric data points, alarm cannot evaluate properly.
  2. Step 2: Confirm impact on alarm state

    Without enough data points, alarm never sees enough breaches to enter ALARM state.
  3. Final Answer:

    The alarm's EvaluationPeriods is set higher than the number of metric data points -> Option A
  4. Quick Check:

    EvaluationPeriods > data points = no alarm [OK]
Hint: Ensure enough data points for EvaluationPeriods [OK]
Common Mistakes:
  • Assuming threshold too low prevents alarm
  • Confusing notification with monitoring
  • Thinking invalid SNS prevents alarm state
5. You want to create a CloudWatch alarm that triggers an auto-scaling action when average CPU utilization exceeds 60% for 5 minutes, but only if this happens during business hours (9 AM to 5 PM). Which approach best achieves this?
hard
A. Create a CloudWatch alarm with threshold 60% and EvaluationPeriods 1, then use EventBridge to trigger scaling only during business hours
B. Set the alarm threshold to 60% and EvaluationPeriods to 5, and configure the alarm to be active only during business hours
C. Create a CloudWatch alarm with threshold 60% and EvaluationPeriods 5, then use a Lambda function triggered by the alarm to check time and trigger scaling
D. Set the alarm threshold to 60% and EvaluationPeriods 5, and configure auto-scaling to ignore alarms outside business hours

Solution

  1. Step 1: Understand alarm and time condition needs

    CloudWatch alarms alone cannot restrict triggering by time; external logic is needed.
  2. Step 2: Evaluate options for time-based control

    Using a Lambda triggered by the alarm to check current time and decide on scaling is flexible and precise.
  3. Step 3: Assess other options

    EventBridge can schedule events but not filter alarm triggers by time; auto-scaling ignores alarms is not a feature.
  4. Final Answer:

    Create a CloudWatch alarm with threshold 60% and EvaluationPeriods 5, then use a Lambda function triggered by the alarm to check time and trigger scaling -> Option C
  5. Quick Check:

    Alarm + Lambda time check = controlled scaling [OK]
Hint: Use Lambda to add time logic after alarm triggers [OK]
Common Mistakes:
  • Expecting alarm to handle time filtering alone
  • Assuming auto-scaling ignores alarms by time
  • Using EventBridge without alarm integration
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard