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?
ACreate a CloudWatch alarm with threshold 60% and EvaluationPeriods 1, then use EventBridge to trigger scaling only during business hours
BSet the alarm threshold to 60% and EvaluationPeriods to 5, and configure the alarm to be active only during business hours
CCreate a CloudWatch alarm with threshold 60% and EvaluationPeriods 5, then use a Lambda function triggered by the alarm to check time and trigger scaling
DSet the alarm threshold to 60% and EvaluationPeriods 5, and configure auto-scaling to ignore alarms outside business hours
Step-by-Step Solution
Solution:
Step 1: Understand alarm and time condition needs
CloudWatch alarms alone cannot restrict triggering by time; external logic is needed.
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.
Step 3: Assess other options
EventBridge can schedule events but not filter alarm triggers by time; auto-scaling ignores alarms is not a feature.
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
Quick Check:
Alarm + Lambda time check = controlled scaling [OK]
Quick Trick: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
Master "CloudWatch" in AWS
9 interactive learning modes - each teaches the same concept differently