
Answer-first summary for fast verification
Answer: Modify the Lambda function to write the API operation name, response code, and version number as a log line to an Amazon CloudWatch Logs log group. Configure a CloudWatch Logs metric filter that increments a metric for each API operation name. Specify response code and application version as dimensions for the metric.
Option A is the most straightforward and effective method. By writing the required information as a log line to CloudWatch Logs and configuring a metric filter to increment metrics based on this data, the company can efficiently gather the metrics it needs with minimal complexity. This approach leverages existing AWS services in a simple and direct manner, aligning well with the company's requirements. Additionally, a CloudWatch Logs metric filter allows specifying response code and application version as dimensions, which fulfills the requirement of gathering metrics for each API operation by response code for each version of the application.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
A company's mobile application, which is accessed by various users including testers, makes HTTP API calls to an Application Load Balancer (ALB). This ALB directs these calls to an AWS Lambda function. The application's version is indicated in the user-agent header sent with each API request. Following recent API modifications, the company has encountered application issues and seeks to collect metrics for each API operation by response code, specific to each application version in use. The DevOps engineer has already updated the Lambda function to capture the API operation name, version from the user-agent header, and response code. What further steps should the DevOps engineer implement to obtain these required metrics?
A
Modify the Lambda function to write the API operation name, response code, and version number as a log line to an Amazon CloudWatch Logs log group. Configure a CloudWatch Logs metric filter that increments a metric for each API operation name. Specify response code and application version as dimensions for the metric.
B
Modify the Lambda function to write the API operation name, response code, and version number as a log line to an Amazon CloudWatch Logs log group. Configure a CloudWatch Logs Insights query to populate CloudWatch metrics from the log lines. Specify response code and application version as dimensions for the metric.
C
Configure the ALB access logs to write to an Amazon CloudWatch Logs log group. Modify the Lambda function to respond to the ALB with the API operation name, response code, and version number as response metadata. Configure a CloudWatch Logs metric filter that increments a metric for each API operation name. Specify response code and application version as dimensions for the metric.
D
Configure AWS X-Ray integration on the Lambda function. Modify the Lambda function to create an X-Ray subsegment with the API operation name, response code, and version number. Configure X-Ray insights to extract an aggregated metric for each API operation name and to publish the metric to Amazon CloudWatch. Specify response code and application version as dimensions for the metric.