Lesson 1 of 4 Monitoring and Troubleshooting Pipelines

Monitoring Pipeline Health with CloudWatch Metrics, Logs and Alarms

This lesson explains how Amazon CloudWatch monitors pipeline health: metrics show what is happening, logs show why, and alarms tell people when to act.

Learning outcomes

After completing this lesson, you will be able to:

  • Identify the metrics that matter for each pipeline service.
  • Configure alarms and dashboards.
  • Manage log retention and encryption.

Metrics that matter for pipelines

Each service in a pipeline publishes CloudWatch metrics that reveal its health. For Glue, job metrics and observability metrics show skew, memory pressure and throughput. For EMR, YARN available memory and pending applications show whether a cluster needs more capacity. For Kinesis, a rising IteratorAgeMilliseconds shows consumers falling behind, and throttling metrics show shards at their limits.

For Lambda, errors, duration, throttles and, for stream sources, iterator age matter most. For Redshift, CPU, the time queries wait in queues and disk usage show whether the warehouse is under strain. For Step Functions and MWAA, failed executions and scheduler health show whether pipelines run. Alarms on these metrics catch problems before users notice. The following table summarises the metrics.

ServiceKey metrics
GlueJob metrics and observability metrics for skew, memory and throughput
EMRYARN memory, pending applications
KinesisIteratorAgeMilliseconds, throttling
LambdaErrors, duration, throttles, iterator age
RedshiftCPU, query queue time, disk usage
Step Functions, MWAAFailed executions; scheduler health
Match the pairs

Key pipeline metrics

Exam skills 3.3.2 · 3.3.4

Match each service with the metric that best shows its health.

Log in to try this activity Interactive activities are free with an account.

Alarms and dashboards

Metrics and logs are useful only if someone notices when they show a problem. A CloudWatch alarm evaluates a metric against a threshold over a number of periods, for example Glue job failures greater than zero in five minutes, and when the condition is met, it notifies people through Amazon SNS or triggers an action, such as an Auto Scaling policy or a Systems Manager runbook.

Fixed thresholds do not suit every metric, because normal values vary by time of day and day of week. Anomaly detection alarms learn a metric's normal pattern and alert when it moves outside the expected band, which suits measures such as records ingested per hour. Composite alarms combine several alarms with logical conditions, so one incident produces one notification instead of many. Dashboards bring metrics and alarm states from many services onto one screen, giving an operational view of a whole pipeline.

The following diagram shows a morning's timeline for a daily sales table and the monitoring signal behind each alert.

The four signals for the daily sales table. An EventBridge rule reports a failed Glue job at once, an alarm catches a job running longer than usual, and an alarm on Kinesis iterator age catches a stream falling behind. The freshness alarm at 06:30, on a LastSuccessfulLoad metric the final step publishes, also catches a job that never started, before users look at 07:00.
The job window is illustrative.
Match the pairs

Alarm types

Exam skills 3.3.3

Match each requirement with the CloudWatch alarm feature.

Log in to try this activity Interactive activities are free with an account.

Logs

Log groups each have a retention setting (by default never expiring) and optional KMS encryption. Lambda supports structured JSON logs and log levels; Glue offers continuous logging of driver and executor logs.

Three features make logs useful beyond reading them line by line. A metric filter matches a pattern in log events, such as lines containing ERROR, and turns the matches into a metric that an alarm can watch. A subscription filter streams matching log events in real time to Lambda, to Firehose for delivery to S3, or to OpenSearch for search and analysis. CloudWatch Logs Insights runs interactive queries across log groups, with commands such as filter, stats and parse, for example counting errors per job per hour. The following table summarises the features.

FeatureTurns logs into
Metric filtersMetrics you can alarm on, such as a count of ERROR lines
Subscription filtersReal-time streams to Lambda, Firehose (then S3) or OpenSearch
CloudWatch Logs InsightsInteractive queries with fields, filter, stats and parse

The following diagram shows the three ways a log group feeds monitoring and analysis.

Three ways to use a log group beyond reading it. A metric filter turns matching events, such as ERROR lines, into a metric an alarm can watch. A subscription filter streams matching events in real time to Lambda, Firehose or OpenSearch. CloudWatch Logs Insights runs interactive queries across log groups.
The targets shown are examples.
Spot the bug

A Logs Insights query

Exam skills 3.3.8 · 4.4.4 · 3.3.7 · 4.4.2

Find the lines that stop this query from counting errors per job per hour.

Log in to try this activity Interactive activities are free with an account.
Worked example

Knowing a pipeline is late before anyone asks

Business users complain when the daily sales table is not ready by 07:00. The team wants to know first.

SignalImplementation
Job failedEventBridge rule on Glue Job State Change FAILED → SNS
Job slowAlarm on Glue job elapsed time above its usual range
Data not freshThe final step publishes a custom metric LastSuccessfulLoad; an alarm fires if it has not been updated by 06:30
Stream falling behindAlarm on Kinesis GetRecords.IteratorAgeMilliseconds

The freshness metric catches the case the others miss: a job that never started at all. Alarms based on the absence of a success signal are essential for scheduled pipelines.

Check yourself

How can logs be streamed to S3 or OpenSearch?

Show answer

With a subscription filter that sends them through Firehose.

Exam Tips

Remember for the exam

  • To alert on ERROR lines in logs, create a metric filter and an alarm.
  • To query logs interactively, use CloudWatch Logs Insights.
  • To stream logs to S3 or OpenSearch, use a subscription filter, through Firehose.
  • To detect consumers falling behind a stream, alarm on the iterator age.
  • Logs are kept for ever by default, so set a retention period.