Explore the essential aspects of AWS Lambda error handling and monitoring with our specially curated set of 30 multiple-choice questions. This collection covers topics like monitoring Lambda functions with CloudWatch, logging errors, setting alarms, and utilizing Dead Letter Queues. Use these AWS Lambda MCQ questions and answers to test and improve your knowledge. Check the answers at the end for a quick review.
Chapter 5: Error Handling and Monitoring
1. Monitoring Lambda Functions with AWS CloudWatch
Which AWS service is used to monitor Lambda functions in real-time? a. Amazon S3 b. AWS CloudTrail c. AWS CloudWatch d. AWS CodeDeploy
CloudWatch Metrics for Lambda include which of the following? a. Memory usage b. Total invocations c. Throttles d. All of the above
What is the default retention period for Lambda function logs in CloudWatch? a. 7 days b. 30 days c. 60 days d. 90 days
Which Lambda metric indicates how often the function execution was throttled? a. Errors b. Invocations c. Throttles d. Duration
What CloudWatch feature helps analyze Lambda function performance over time? a. CloudWatch Dashboards b. CloudWatch Logs Insights c. CloudWatch Metrics d. CloudWatch Events
2. Logging in Lambda Functions with CloudWatch Logs
What is the primary service used for logging Lambda function output? a. AWS CloudWatch Logs b. Amazon S3 c. Amazon Elasticsearch d. AWS X-Ray
Which log level is commonly used in Lambda functions for detailed troubleshooting? a. INFO b. ERROR c. DEBUG d. TRACE
Which API action is used to send logs from Lambda to CloudWatch? a. PutLogEvents b. SendLogEvents c. PutCloudWatchLogs d. LogCloudWatchEvent
By default, which log group is created in CloudWatch for each Lambda function? a. /aws/lambda/function_name b. /aws/logs/function_name c. /aws/lambda/logs d. /cloudwatch/logs/function_name
How can you view logs for a Lambda function in the AWS Management Console? a. Through AWS X-Ray b. In CloudWatch Logs under the log group c. In the Lambda function configuration page d. In CloudTrail logs
3. Setting up Alarms for Lambda Errors
What type of CloudWatch alarm would you set to monitor Lambda function failures? a. Alarm for function invocation b. Alarm for function duration c. Alarm for error count d. Alarm for memory usage
Which CloudWatch metric is used to trigger an alarm for Lambda errors? a. Duration b. Errors c. Throttles d. Invocations
To receive notifications when an alarm is triggered for Lambda errors, you must configure: a. Amazon SNS b. Amazon SES c. AWS SQS d. AWS Lambda destination
How do you set a threshold for Lambda error rate in CloudWatch? a. Set an error count threshold in the alarm configuration b. Set a memory usage threshold c. Set a function duration threshold d. Set a threshold for invocation count
What is the first step to create a CloudWatch alarm for Lambda? a. Choose the error metric for Lambda function b. Create a CloudTrail event c. Set up an SQS queue d. Enable detailed logging
4. Retries and Dead Letter Queues (DLQs)
What happens when a Lambda function execution fails and retries are enabled? a. The function execution stops permanently b. Lambda retries the execution until it succeeds c. The error is logged and no retries occur d. The error is sent to CloudWatch logs
What is the purpose of using a Dead Letter Queue (DLQ) in AWS Lambda? a. To retry failed Lambda executions b. To store logs for Lambda functions c. To capture failed event invocations d. To scale Lambda functions automatically
What service is typically used for configuring a Dead Letter Queue with Lambda? a. Amazon SQS b. AWS SNS c. AWS Step Functions d. Amazon DynamoDB
How do you configure a DLQ for a Lambda function? a. By linking a CloudWatch alarm b. By specifying an SQS queue or SNS topic in the function’s configuration c. By using the Lambda API d. By setting a Lambda timeout
What happens to events sent to a Dead Letter Queue? a. They are automatically retried b. They are deleted after 24 hours c. They are captured for later analysis d. They are escalated to AWS support
5. Handling Function Failures Gracefully
Which Lambda setting helps minimize the impact of function errors? a. Retry policy b. Timeout setting c. Memory allocation d. Concurrency settings
What is the best practice for Lambda functions that need to handle transient errors? a. Setting a long timeout b. Enabling retries c. Disabling error logging d. Using AWS Step Functions
To handle failures in Lambda gracefully, what is the primary mechanism to ensure success? a. Dead Letter Queues b. AWS Step Functions c. API Gateway integration d. S3 event triggers
Which Lambda retry strategy ensures that no event is lost during transient failures? a. Linear backoff b. Exponential backoff c. Immediate retries d. No retries
Which AWS service provides insight into the error stack traces of Lambda failures? a. AWS X-Ray b. AWS Config c. CloudWatch Events d. AWS Systems Manager
How can Lambda failures be logged for troubleshooting and later analysis? a. By using Amazon S3 b. By integrating with AWS X-Ray c. By capturing logs in CloudWatch Logs d. By using Amazon RDS
What happens if a Lambda function exceeds its maximum retries? a. The function is terminated b. The event is automatically rerouted to another function c. The event is sent to a Dead Letter Queue d. The event is lost forever
In what case should you avoid using retries in Lambda? a. When the function is stateless b. When the function handles critical data c. When the function should not fail gracefully d. When retrying the failure could result in duplicate actions
How does AWS Lambda handle failures when the retry limit is exceeded? a. The function is marked as failed and ignored b. The function fails permanently and no further retries are attempted c. The event is moved to a Dead Letter Queue d. The error is reported via Amazon SNS
Which AWS service helps you orchestrate retries and failure handling with Lambda? a. AWS CloudFormation b. AWS Step Functions c. AWS Batch d. AWS AppSync
Answer Key
QNo
Answer
1
c. AWS CloudWatch
2
d. All of the above
3
b. 30 days
4
c. Throttles
5
b. CloudWatch Logs Insights
6
a. AWS CloudWatch Logs
7
c. DEBUG
8
a. PutLogEvents
9
a. /aws/lambda/function_name
10
b. In CloudWatch Logs under the log group
11
c. Alarm for error count
12
b. Errors
13
a. Amazon SNS
14
a. Set an error count threshold in the alarm configuration
15
a. Choose the error metric for Lambda function
16
b. Lambda retries the execution until it succeeds
17
c. To capture failed event invocations
18
a. Amazon SQS
19
b. By specifying an SQS queue or SNS topic in the function’s configuration
20
c. They are captured for later analysis
21
a. Retry policy
22
b. Enabling retries
23
b. AWS Step Functions
24
b. Exponential backoff
25
a. AWS X-Ray
26
c. By capturing logs in CloudWatch Logs
27
c. The event is sent to a Dead Letter Queue
28
d. When retrying the failure could result in duplicate actions