CloudConsole

CloudWatch alarm: Lambda Errors

Updated 16 November 2026 · How we write and check guides

Short answer

Alarm on AWS/Lambda Errors per FunctionName using the Sum over 60 seconds, firing when it is above your threshold for 3 consecutive minutes. Choose a threshold above zero that reflects how many failed invocations the function can tolerate; for low-traffic critical functions that may be 0, for high-volume ones an error rate via metric math works better.

Chart of the Errors alarm: Sum per 1-minute period, ALARM when 3 of 3 datapoints are > 5
How the recommended alarm evaluates, with AWS's settings from this page and the page's example threshold. The metric values are illustrative.

What Lambda counts as an error

Errors counts invocations that ended in a function error: an exception your handler threw or did not catch, a timeout, running out of memory, or the runtime crashing. Throttled requests are not included; they appear in Throttles.

Two details trip people up. First, for asynchronous invocations (S3, SNS, EventBridge) Lambda retries failures, so one bad event can count up to three times. Second, a handler that catches an exception and returns a normal response is a success as far as this metric is concerned, even if the caller sees an error body. API Gateway 5xx responses built by your own code will not show up here.

Recommended alarm settings

SettingRecommended value
NamespaceAWS/Lambda
MetricErrors
DimensionsFunctionName
StatisticSum
ThresholdDepends on your situation (choose a value above zero)
Period60 seconds
Datapoints to alarm3
Evaluation periods3
Comparison operatorGreaterThanThreshold

Choosing a threshold

  • Critical, low-volume functions (payments, provisioning): use 0, so any error for three minutes running pages someone.
  • Steady, high-volume functions: look at a week of one-minute Sums and set the threshold above the normal background, for example the 99th percentile of minute values plus a margin.
  • Variable traffic: a fixed count is too sensitive at peak and blind at night. Use metric math, 100 * Errors / Invocations, and alarm on a percentage such as 2%.

Three of three minutes filters single transient failures, such as one downstream timeout, while still reacting fast.

For functions behind API Gateway that catch exceptions and return error responses, this alarm will stay quiet during an incident. Either let unexpected exceptions propagate, or pair this alarm with one on the API's 5xx metric.

Create the alarm

aws cloudwatch put-metric-alarm \
  --alarm-name lambda-checkout-errors \
  --alarm-description "checkout-handler more than 5 errors a minute for 3 minutes" \
  --namespace AWS/Lambda \
  --metric-name Errors \
  --dimensions Name=FunctionName,Value=checkout-handler \
  --statistic Sum \
  --period 60 \
  --evaluation-periods 3 \
  --datapoints-to-alarm 3 \
  --threshold 5 \
  --comparison-operator GreaterThanThreshold \
  --treat-missing-data notBreaching \
  --alarm-actions arn:aws:sns:eu-west-2:123456789012:oncall-alerts

No invocations means no errors, so notBreaching is the right missing-data choice.

When it fires

  1. Read the logs. Use a Logs Insights error count to see when errors started and which messages dominate.
  2. Classify: Task timed out lines point to timeouts; Runtime.ExitError or a killed signal to memory; a stack trace to code or a dependency.
  3. Correlate with deploys. If errors began right after a new version, roll back the alias first and investigate after.
  4. Protect events: for async sources, make sure a dead-letter queue or on-failure destination is set, so events that keep failing are kept.

Questions

How do I alarm on Lambda timeouts specifically?

Timeouts are included in Errors. For a dedicated signal, use a metric filter on the log group matching "Task timed out" or alarm on Duration approaching the configured timeout.

Can a CloudWatch alarm trigger a Lambda function?

Yes. Configure the function as the alarm action directly or subscribe it to the SNS topic the alarm notifies, for example to post to chat.

Why does Errors show more failures than requests I sent?

Asynchronous invocations are retried on error, and each attempt is counted separately.

When this happens away from your desk

Lambda error alarms are the ones most likely to buzz while you are out. CloudConsole, a phone app for AWS, is built to show the alarm with the recent error log lines on the same screen.

Did it start after a deploy? What changed? on the app’s alarm screen lists the deploys and configuration changes from the hour before the alarm fired.

About the app → · Download on the App Store

Sources