AWS Certified Developer – Associate (DVA-C02) — Question 329
A company's application has an AWS Lambda function that processes messages from IoT devices. The company wants to monitor the Lambda function to ensure that the Lambda function is meeting its required service level agreement (SLA).
A developer must implement a solution to determine the application's throughput in near real time. The throughput must be based on the number of messages that the Lambda function receives and processes in a given time period. The Lambda function performs initialization and post-processing steps that must not factor into the throughput measurement.
What should the developer do to meet these requirements?
Answer options
- A. Use the Lambda function's ConcurrentExecutions metric in Amazon CloudWatch to measure the throughput.
- B. Modify the application to log the calculated throughput to Amazon CloudWatch Logs. Use Amazon EventBridge to invoke a separate Lambda function to process the logs on a schedule.
- C. Modify the application to publish custom Amazon CloudWatch metrics when the Lambda function receives and processes each message. Use the metrics to calculate the throughput.
- D. Use the Lambda function's Invocations metric and Duration metric to calculate the throughput in Amazon CloudWatch.
Correct answer: C
Explanation
Publishing custom Amazon CloudWatch metrics directly from the application code allows the developer to record data points only during the specific message processing phase, avoiding the inclusion of initialization and post-processing times. Standard metrics like Invocations, Duration, and ConcurrentExecutions are too coarse because they measure the entire execution lifecycle of the Lambda function. Scheduled log processing via EventBridge is not near real-time and introduces unnecessary operational overhead compared to direct metric emission.