Courseiva
Monitoring and Logging →easyMultiple Select

DOP-C02 Amazon CloudWatch Metrics for Lambda Practice Question

A DevOps engineer is investigating a performance issue in a serverless application using AWS Lambda. The engineer wants to view the duration of each invocation and identify cold starts. Which TWO AWS services should be used? (Choose TWO.)

⚠ Common exam trap

Candidates often choose Amazon CloudWatch Metrics because it includes a 'duration' metric, but this metric is aggregated across invocations and does not reveal individual invocation durations or definitively identify cold starts. The correct approach is to use X-Ray for tracing and CloudWatch Logs for per-invocation execution details.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

AWS X-Ray to trace invocations and detect cold starts

Option B (AWS X-Ray) is correct because X-Ray traces individual Lambda invocations end-to-end, showing per-invocation duration via subsegments and explicitly flagging cold starts with an 'Initialization' subsegment, which is exactly what the engineer needs to identify cold starts. Option D (Amazon CloudWatch Logs) is correct because Lambda automatically streams each invocation's execution logs, including the REPORT line with Duration, Billed Duration, Memory Size, and Init Duration (the latter indicating a cold start), so per-invocation duration and cold-start evidence can be extracted from these logs. Option A (CloudWatch Metrics) is not correct here because Lambda metrics such as Duration and Invocations are aggregated at one-minute granularity and do not expose per-invocation duration or cold-start identification. Option C (AWS CloudTrail) is not correct because it only records control-plane API calls (e.g., CreateFunction, Invoke via management events) and does not provide invocation duration or cold-start data. Option E (AWS Config) is not correct because it tracks Lambda configuration/resource changes for compliance, not runtime performance or invocation timing.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Amazon CloudWatch Metrics for Lambda (duration, invocations)

    Why it's wrong here

    Amazon CloudWatch Metrics for Lambda emits Invocations, Duration, Errors, Throttles, and other metrics, with the Duration metric supporting statistics such as Average, Maximum, and percentiles. These metrics reveal performance trends and detect slow invocations across the function's history, even though they do not expose per-request log detail. This makes it a correct and necessary tool for analyzing overall performance.

  • ✓

    AWS X-Ray to trace invocations and detect cold starts

    Why this is correct

    AWS X-Ray can trace Lambda requests and annotate cold starts when tracing is enabled, but it requires the function to use the X-Ray SDK and sampling to be active. X-Ray focuses on distributed request flows across services, not on measuring the execution performance of the Lambda function itself in aggregate. For an initial performance investigation, CloudWatch Logs and Metrics give the definitive invocation and duration data without extra instrumentation.

  • ✗

    AWS CloudTrail to record Lambda API calls

    Why it's wrong here

    AWS CloudTrail records control-plane API calls for Lambda, such as CreateFunction, UpdateFunctionConfiguration, or DeleteFunction. It does not capture function invocation data, execution duration, or any runtime performance signals. Thus it is useful for auditing who changed a function, but it cannot help troubleshoot a performance problem in the function's execution.

  • ✓

    Amazon CloudWatch Logs for Lambda execution logs

    Why this is correct

    Amazon CloudWatch Logs is the primary sink for Lambda execution output: every invocation appends a log stream containing application logs, stack traces, and an automated REPORT line with Duration, Billed Duration, and Init Duration. This per-invocation detail lets the engineer correlate slow requests with specific code branches, error messages, or cold-start initialization events. It is therefore a direct source of execution-level performance evidence.

  • ✗

    AWS Config to track Lambda configuration changes

    Why it's wrong here

    AWS Config tracks configuration items for Lambda functions, including memory size, timeout, environment variables, and VPC settings. While checking configuration history could reveal a change that preceded a performance regression, Config does not provide runtime metrics or invocation logs. It cannot show how long a function took to execute or how often it was invoked.

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

This DOP-C02 question is part of Courseiva's 1,298-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DOP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DOP-C02 exam.