CloudWatch Metric Guide

AWS/Lambda/DurationMilliseconds

DurationAWS Lambda CloudWatch metric

Duration measures the elapsed wall-clock time from when the Lambda function handler begins executing to when it returns or times out. CloudWatch publishes minimum, maximum, average, and percentile statistics.

What it measures

About Duration

Duration measures the elapsed wall-clock time from when the Lambda function handler begins executing to when it returns or times out. CloudWatch publishes minimum, maximum, average, and percentile statistics.

NamespaceAWS/Lambda
Metric nameDuration
UnitMilliseconds
AWS docsOfficial AWS Lambda metrics reference

Why this metric matters

Duration has two failure modes. The obvious one is timeout: if Duration reaches the function's configured timeout, Lambda terminates the invocation and records an error. The subtler one is cost and performance creep — a function that used to run in 200ms now runs in 2 seconds because a downstream dependency slowed down, and nobody noticed because it didn't error.

For synchronous Lambda (API Gateway, ALB), Duration directly equals latency felt by the user. For async Lambda, Duration determines how many invocations fit inside the concurrency limit — a function that doubles in duration effectively halves your throughput capacity before you hit throttle limits. Monitoring p99 Duration separately from average Duration catches the worst-case outliers that average metrics hide.

Recommended alarm threshold for Duration

Recommended threshold

p99 Duration > 80% of the function's configured timeout

Alarms on average Duration miss the long tail — a function with a 30-second timeout might average 500ms but have p99 at 25 seconds, meaning 1% of invocations are about to timeout. The 80% threshold on p99 (Nuberio recommendation) gives a buffer to investigate before timeouts become errors. Monitor the p99 statistic specifically, not the default Average.

Is your Duration alarm already set up correctly?

The free Nuberio Audit scans your CloudWatch setup and flags missing or misconfigured alarms — including Duration — in 5 minutes.

Run a free audit →

Common failures that show up in Duration

When Duration reaches an alarm threshold, these are the most common root causes — in order of how often Nuberio sees them across customer AWS accounts.

  • Downstream API degradation — a call to an external service or RDS that normally completes in 50ms starts taking 5 seconds due to the dependency being under load

  • Cold start + VPC initialization — VPC-attached Lambda functions incur ENI attachment time on cold starts, adding 1–10 seconds to the first invocation after scale-out

  • Large payload processing — function receives a larger S3 object or SQS message than expected and processing time grows non-linearly

  • N+1 database query pattern — each item in a batch triggers a separate query, so Duration scales linearly with batch size

  • Memory-constrained processing — insufficient memory allocation forces the function to use more CPU time for the same computation (Lambda CPU scales with memory allocation)

How the Nuberio Audit checks Duration

The free Audit scans every AWS Lambda resource in your account and checks whether a Duration alarm exists, whether its threshold and evaluation period are configured sensibly, and flags it if it's missing entirely. Every finding comes with the exact CLI command to fix it — read-only access, no credit card, results in about 5 minutes.

Nuberio Audit

Scans your CloudWatch setup for missing or misconfigured Duration alarms. Free, 5-minute read-only scan.

Run a free audit →

Related AWS Lambda metrics

Duration rarely fails in isolation. These metrics tend to correlate — monitor them together for complete AWS Lambda coverage.

FAQ

Frequently asked questions about Duration

Common questions about setting up CloudWatch alarms for Duration in AWS Lambda.

What is the recommended CloudWatch alarm threshold for Duration?+

p99 Duration > 80% of the function's configured timeout. Alarms on average Duration miss the long tail — a function with a 30-second timeout might average 500ms but have p99 at 25 seconds, meaning 1% of invocations are about to timeout. The 80% threshold on p99 (Nuberio recommendation) gives a buffer to investigate before timeouts become errors. Monitor the p99 statistic specifically, not the default Average.

Which CloudWatch namespace does Duration belong to?+

Duration is published in the AWS/Lambda namespace with a unit of Milliseconds. You can find it in the CloudWatch console under "Metrics" → "AWS/Lambda". See the AWS Lambda CloudWatch metrics reference in the AWS documentation.

Does Nuberio automatically create CloudWatch alarms for Duration?+

No — the free Nuberio Audit does not create alarms for you. It scans your CloudWatch setup and tells you which AWS Lambda resources are missing a Duration alarm, then gives you the exact CLI command to create it yourself.

Can I use Nuberio without already having a Duration alarm set up?+

Yes. The free Audit works whether or not you have any Duration alarm configured — it reads the resource directly from CloudWatch and tells you which resources need one, plus the copy-paste AWS CLI command to create it.

This page is part of the CloudWatch metric guide — thresholds and debugging guidance for every metric across RDS, Lambda, ECS, ALB, EC2, DynamoDB, SQS, API Gateway, S3, CloudFront, ElastiCache, and EKS. To find which AWS Lambda alarms your account is missing — including Duration — run the free CloudWatch alarm audit. The scan takes under 5 minutes and requires no account.