Learn how to troubleshoot your Lambda function code by examining the logs in AWS. Discover where the logs are stored and how to access them.
Table of Contents
Question
An application uses Lambda functions to extract metadata from files uploaded to an S3 bucket; the metadata is stored in Amazon DynamoDB. The application starts behaving unexpectedly, and the developer wants to examine the logs of the Lambda function code for errors.
Based on this system configuration, where would the developer find the logs?
A. Amazon S3
B. AWS CloudTrail
C. Amazon CloudWatch
D. Amazon DynamoDB
Answer
C. Amazon CloudWatch
Explanation
The correct answer is C. Amazon CloudWatch.
This solution will allow the developer to find the logs of the Lambda function code for errors because Amazon CloudWatch is a service that collects, monitors, and analyzes metrics and logs from AWS resources and applications. By default, Lambda automatically sends logs from function code to CloudWatch Logs, which is a feature of CloudWatch that stores and accesses log data from AWS services and applications. The developer can use the CloudWatch console or API to view and search the logs of the Lambda function code for errors, as well as create alarms, dashboards, and metrics based on the log data.
The other options are not correct because:
- Option A: Amazon S3 is a service that provides object storage for any type of data. The application uses S3 to store files uploaded by users, but not logs from Lambda function code. Therefore, the developer will not find the logs of the Lambda function code in S3.
- Option B: AWS CloudTrail is a service that records AWS API calls and related events for AWS accounts and services. The application uses CloudTrail to track user activity and API usage, but not logs from Lambda function code. Therefore, the developer will not find the logs of the Lambda function code in CloudTrail.
- Option D: Amazon DynamoDB is a service that provides a fully managed NoSQL database for applications. The application uses DynamoDB to store metadata extracted from files by Lambda functions, but not logs from Lambda function code. Therefore, the developer will not find the logs of the Lambda function code in DynamoDB.
Therefore, option C is the best solution for finding the logs of the Lambda function code for errors.
The latest AWS Certified Developer – Associate DVA-C02 certification actual real practice exam question and answer (Q&A) dumps are available free, which are helpful for you to pass the AWS Certified Developer – Associate DVA-C02 exam and earn AWS Certified Developer – Associate DVA-C02 certification.