AWS Certified Developer – Associate (DVA-C02) — Question 545
A company’s developer needs to activate Amazon CloudWatch Logs Insights for an application’s AWS Lambda functions. The company uses an AWS Serverless Application Model (AWS SAM) template to deploy the application. The SAM template includes a logical resource that is named CloudWatchLogGroup.
How should the developer modify the SAM template to activate CloudWatch Logs Insights for the Lambda functions?
Answer options
- A. Add an output named CloudWatchinsightRule that contains a value of the Amazon Resource Name (ARN) for the CloudWatchLogGroup resource.
- B. Add a parameter named CloudWatchLogGroupNamePrefix that contains a value of the application name. Reference the new parameter in the CloudWatchLogGroup resource.
- C. For each Lambda function, add the layer for the Lambda Insights extension and the CloudWatchLambdaInsightsExecutionRolePolicy AWS managed policy.
- D. For each Lambda function, set Tracing mode to Active and add the CloudWatchLambdaInsightsExecutionRolePolicy AWS managed policy.
Correct answer: C
Explanation
To enable CloudWatch Lambda Insights for AWS Lambda functions, the Lambda Insights extension must be added as a layer to the functions, and the execution role must have the CloudWatchLambdaInsightsExecutionRolePolicy AWS managed policy attached. Modifying log group outputs or parameters (Options A and B) does not activate the monitoring extension. Enabling active tracing (Option D) is used for AWS X-Ray, not CloudWatch Lambda Insights.