Architecture note3 lab guides3 lab guides
CloudWatch · Metrics, Logs and Alarms
Metric math, log retention, and alarms nobody can act on.
Outcome
- Explain the four-level hierarchy: Namespace → MetricName → Dimensions → Data Points
- Explain why changing a dimension value creates a new metric series, not an update
- Choose the correct statistic (Sum vs. Average vs. Maximum) for a given metric type
- Explain CloudWatch's data retention tiers and why querying old data at 1-minute period returns empty
- Explain why querying a non-existent metric returns no error
- Publish custom metrics via
put-metric-datawith correct namespace, dimensions, and unit - Publish multiple metrics in a single API call
- Explain why a dimension key typo creates a ghost metric with no warning
- Explain the difference between standard-resolution and high-resolution metrics
- Explain the 2-week backfill limit and what happens when you exceed it
- Publish custom metrics via
- Use
get-metric-data(notget-metric-statistics) for Metric Math expressions - Compute error rate as
(errors / invocations) * 100without publishing a separate metric - Use
FILL(m1, 0)for counters andFILL(m1, REPEAT)for gauges - Explain why
RATE()is only meaningful on cumulative counters - Handle division by zero in Metric Math using
IF(denominator > 0, expression, 0)
- Use
- Create an anomaly detection model on a custom metric
- Explain the model warm-up states:
PENDING_TRAINING→TRAINED_INSUFFICIENT_DATA→TRAINED - Configure exclusion windows to prevent known anomalies from corrupting the model
- Explain the threshold multiplier tradeoff between sensitivity and false alarm rate
- Explain why an anomaly alarm before model training stays in
INSUFFICIENT_DATA
- Explain the three-level hierarchy: Log Group → Log Stream → Log Event
- Create a log group with an explicit retention policy and explain the cost of omitting one
- Write log events via CLI using millisecond timestamps
- Explain why JSON log events enable better querying than plain text
- Explain why events must be in chronological order within a single
put-log-eventscall
- Run a Logs Insights query via CLI using
start-query+get-query-results - Use
fields,filter,stats,sort, andlimitcorrectly - Compute p99 latency per event type using
pct(field, 99) - Use
bin(1m)to bucket events into time windows - Use
parseto extract fields from plain text logs and explain why order matters - Explain why
filterbeforeparsereturns zero results with no error - Explain why
fieldsafterstatsis invalid
- Run a Logs Insights query via CLI using
- Create a metric filter that counts matching log events
- Create a metric filter that extracts a numeric field value as the metric value
- Use
filter-log-eventsto validate a filter pattern before creating it - Explain why metric filters are not retroactive and when to use Logs Insights instead
- Explain why the term filter
ERRORproduces false positives on JSON logs - Explain why a nested field like
$.context.codemay not match in filter patterns
- Explain the two IAM policies the Agent needs and what each enables
- Write a valid Agent config that collects a log file and
mem_used_percent/disk_used_percent - Verify Agent health using the Agent's own log file on the instance
- Explain why
mem_used_percentis not available inAWS/EC2without the Agent - Explain what to check first when EC2 logs stop arriving in CloudWatch
- Explain the three alarm states: OK, ALARM, INSUFFICIENT_DATA
- Explain why INSUFFICIENT_DATA is not the same as OK and when it occurs
- Create a metric alarm with correct Period, EvaluationPeriods, and DatapointsToAlarm
- Explain the difference between
treat-missing-data notBreachingandbreachingand when to use each - Explain why
EvaluationPeriods=1can cause flapping and howDatapointsToAlarmfixes it - Observe all three state transitions in a single alarm lifecycle
- Create an SNS topic and attach it as an alarm action for ALARM and OK transitions
- Explain that alarm actions fire on state transitions, not continuously while in ALARM
- Subscribe a Lambda function to SNS and parse the alarm payload in the handler
- Explain why a missing Lambda resource policy causes silent action failures
- Explain why an unconfirmed SNS email subscription delivers nothing with no error
- Explain what a composite alarm is and why it reduces alert noise
- Create a composite alarm with AND/OR boolean logic over component alarms
- Explain the AlarmRule syntax: ALARM(), OK(), INSUFFICIENT_DATA(), AND, OR, NOT
- Explain why a typo in a component alarm name causes permanent INSUFFICIENT_DATA
- Explain the tradeoff between noise reduction and sensitivity in composite alarm design
- Create an alarm on a Metric Math expression using
--metricsinstead of--metric-name - Use
IF(denominator > 0, expression, 0)to prevent INSUFFICIENT_DATA from division by zero - Alarm on error rate (%) derived from raw error and invocation counts
- Create a CloudWatch dashboard with alarm status, time-series, and expression widgets
- Explain why
--statistic p99is invalid and--extended-statistic p99is required
- Create an alarm on a Metric Math expression using