Skip to main content

Validation Quiz - MODULE 12

This 30-question quiz allows you to validate your knowledge on Lambda troubleshooting before moving on to the practical lab.


Question 1​

Where can you find the logs of a Lambda function?

A) In S3
B) In CloudWatch Logs, group /aws/lambda/function-name
C) On the EC2 instance
D) In DynamoDB

See the answer

Answer: B

Lambda logs are automatically sent to CloudWatch Logs in the group /aws/lambda/function-name. Each execution container creates a log stream. Ensure the function has CloudWatch Logs permissions.


Question 2​

What does the "Task timed out" error mean?

A) The network connection timed out
B) The function exceeded its configured timeout
C) The trigger timed out
D) The API timed out

See the answer

Answer: B

"Task timed out after X seconds" means the function did not complete within the configured timeout. Solutions: increase the timeout (max 15 min), optimize the code, or find out why the execution is slow (network wait, DB).


Question 3​

How to increase the timeout of a Lambda function?

A) It is not configurable
B) In the function configuration, modify the Timeout parameter (max 15 min)
C) Via code only
D) By contacting AWS

See the answer

Answer: B

The timeout is configurable in the function settings: console, CLI, or CloudFormation/SAM template. The maximum value is 900 seconds (15 minutes). Adjust according to the real time needed plus a margin.


Question 4​

What does the "out of memory" error indicate?

A) The disk is full
B) The function exceeded the allocated memory
C) CloudWatch is out of storage
D) S3 is full

See the answer

Answer: B

"Runtime exited with error: signal: killed" or "Memory Size: X MB Max Memory Used: X MB" indicates the function used all its memory. Solution: increase the allocated memory or optimize the code to use less memory.


Question 5​

How to know how much memory a function uses?

A) It is not measurable
B) In the CloudWatch "REPORT" logs or the "Max Memory Used" metrics
C) Via code
D) In the EC2 console

See the answer

Answer: B

Each invocation generates a REPORT line in the logs: "Memory Size: 128 MB Max Memory Used: 85 MB". The CloudWatch metric "MaxMemoryUsed" also shows this value. If close to the limit, increase the memory.


Question 6​

What is the "Access Denied" error in Lambda?

A) Access denied to the console
B) The function does not have IAM permissions to access a resource
C) The password is incorrect
D) The VPC is blocked

See the answer

Answer: B

"Access Denied" means the function's IAM role does not have the necessary permissions. Check that the role has the policies to access S3, DynamoDB, SQS, or other services used by the code.


Question 7​

How to diagnose Lambda permission errors?

A) Wait for them to disappear
B) Check the logs for the exact error, then adjust the IAM role policies
C) Recreate the function
D) Contact AWS

See the answer

Answer: B

Read the CloudWatch logs to identify the denied resource and action. Check the function's IAM role. Add the necessary policy (e.g., s3:GetObject). Test again. Use IAM Policy Simulator to validate.


Question 8​

A Lambda function in a VPC cannot access the Internet. Why?

A) It's normal
B) Lambda in a VPC requires a NAT Gateway for Internet access
C) The Security Group blocks
D) The logs do not work

See the answer

Answer: B

Lambda in a VPC uses ENIs in private subnets. To access the Internet, configure a NAT Gateway in a public subnet and a route 0.0.0.0/0 to the NAT in the Lambda subnets' route table.


Question 9​

A Lambda function in a VPC cannot access DynamoDB. What to do?

A) Remove the VPC
B) Use a VPC Endpoint for DynamoDB or configure a NAT Gateway
C) Change region
D) Increase memory

See the answer

Answer: B

DynamoDB is a public service. A VPC Lambda needs either a NAT Gateway (costly) or a VPC Endpoint Gateway for DynamoDB (free and recommended). The VPC Endpoint allows private access without going through the Internet.


Question 10​

What is the "Handler not found" error?

A) The handler is not found
B) The configured handler name does not match the function in the code
C) The file does not exist
D) Memory is insufficient

See the answer

Answer: B

This error means Lambda cannot find the specified handler. Check: the format (file.method), the file name (e.g., lambda_function.py), the method name, and that the file is at the root of the package.


Question 11​

How is the handler formatted in Python?

A) handler.py
B) file.function (e.g., lambda_function.lambda_handler)
C) lambda.handler
D) handler()

See the answer

Answer: B

In Python, the format is: file_name.function_name. The default is lambda_function.lambda_handler, so a file lambda_function.py with a function def lambda_handler(event, context). Adjust according to your structure.


Question 12​

What is the "Module not found" error?

A) The AWS module is missing
B) A dependency required by the code is not included in the package
C) Python is not installed
D) The handler is incorrect

See the answer

Answer: B

"Unable to import module" or "Module not found" means a library used in the code is not in the deployment package. Include dependencies in the ZIP or use Lambda Layers.


Question 13​

How to include Python dependencies in Lambda?

A) Install them globally
B) pip install in a folder, include it in the deployment ZIP or use Layers
C) Automatically included
D) Via the console

See the answer

Answer: B

Create a folder, install dependencies: pip install requests -t ./package/, add your code, zip everything. Or use Lambda Layers for shared dependencies. SAM and CDK automate this process.


Question 14​

What is "cold start" and how to detect it?

A) A Lambda bug
B) Initialization delay visible by an "Init Duration" in the REPORT logs
C) A timeout error
D) A memory issue

See the answer

Answer: B

Cold start appears in the logs: "Init Duration: X ms" is only present during cold starts. The "Duration" metric includes this time. Subsequent invocations (warm) do not have an Init Duration.


Question 15​

A function returns a 502 error via API Gateway. What to check?

A) API Gateway only
B) Lambda logs for the real error, Lambda response format
C) Route 53
D) CloudFront

See the answer

Answer: B

502 from API Gateway often means Lambda returned a malformed response or crashed. Check Lambda logs for the error. Ensure the response follows the format expected by API Gateway (statusCode, body, headers).


Question 16​

What response format does API Gateway expect from Lambda?

A) Plain text
B) JSON with statusCode, headers, body
C) XML
D) HTML

See the answer

Answer: B

The expected format is a JSON object with statusCode (200), headers (Content-Type: application/json), and body (a JSON string). The body must be a string, not an object. A malformed response causes a 502 error.


Question 17​

How to debug a Lambda function in production?

A) Connect to the server
B) Analyze CloudWatch logs, enable X-Ray for tracing
C) Modify the code in prod
D) Wait for complaints

See the answer

Answer: B

Use CloudWatch Logs for error messages. Enable AWS X-Ray to trace requests across services (latency, errors). CloudWatch Insights allows queries on logs. Add structured logging in the code.


Question 18​

What is AWS X-Ray for Lambda?

A) An X-ray of servers
B) A distributed tracing service that shows the path of requests
C) An antivirus
D) A backup tool

See the answer

Answer: B

AWS X-Ray traces requests across Lambda and other services (API Gateway, DynamoDB, S3). It shows a map of services, latencies, and helps identify bottlenecks and errors.


Question 19​

A function fails intermittently. What to check?

A) The code only
B) Logs for patterns, timeouts, cold starts, throttles
C) Nothing, it's normal
D) The Security Group

See the answer

Answer: B

Intermittent failures can be due to: timeouts (slow external resources), cold starts (failed initialization), throttling (concurrency limits), unavailable external resources, or closed connections (connection pooling).


Question 20​

What is Lambda "throttling"?

A) Speed limitation of the code
B) Refusal of invocations because the concurrency limit is reached
C) Data compression
D) Memory limitation

See the answer

Answer: B

Throttling occurs when the function reaches its concurrency limit (reserved or regional). Additional invocations are refused with a 429 error (TooManyRequestsException). Increase limits or implement a queue.


Question 21​

How to detect if Lambda is throttled?

A) Impossible to detect
B) CloudWatch metric "Throttles", 429 error in calling logs
C) Via code
D) In EC2

See the answer

Answer: B

The CloudWatch metric "Throttles" counts refused invocations. The caller receives a 429 TooManyRequestsException error. Monitor this metric and create alarms to detect capacity issues.


Question 22​

What is the Dead Letter Queue (DLQ) and when is it used?

A) A queue of dead messages
B) A destination for failed events after all retries (asynchronous invocation)
C) A backup queue
D) A priority queue

See the answer

Answer: B

The DLQ receives events that failed after automatic retries (2 for async). Configure an SQS or SNS as DLQ. Analyze these messages to understand and correct failures.


Question 23​

How to configure retries for Lambda?

A) Via code only
B) Depends on the invocation type: configurable for async, automatic for streams
C) No retries
D) Via IAM

See the answer

Answer: B

Async invocations: 2 retries by default (configurable 0-2), with exponential backoff. Streams (Kinesis, DynamoDB): retry until data expires or success. Synchronous: no automatic retry, the caller manages.


Question 24​

A Lambda function is very slow. What to check first?

A) The function name
B) REPORT logs for Duration, Memory Used, and external calls
C) The trigger
D) The region

See the answer

Answer: B

Analyze the REPORT logs: Duration (total time), Billed Duration, Memory Used. If close to the memory limit, increase it. Check external calls (DB, API) that may be slow. Use X-Ray for details.


Question 25​

Does increasing Lambda memory affect speed?

A) No
B) Yes, more memory = more CPU = potentially faster execution
C) It slows it down
D) Only for Java

See the answer

Answer: B

CPU is allocated proportionally to memory. At 1,769 MB, you get 1 full vCPU. More memory means more computing power, which can reduce execution time and sometimes even total cost.


Question 26​

How to test a Lambda function locally?

A) Impossible
B) AWS SAM CLI, LocalStack, or by running the Python/Node file directly
C) Only in production
D) Via EC2

See the answer

Answer: B

Test locally with: AWS SAM CLI (sam local invoke), LocalStack to emulate Lambda, or run your function directly with a mock event. This speeds up the development cycle before deployment.


Question 27​

What is the "ECONNREFUSED" error in Lambda?

A) Connection refused by Lambda
B) The function cannot connect to an external service (endpoint unreachable)
C) Permission error
D) Lambda timeout

See the answer

Answer: B

ECONNREFUSED means the connection was refused by the target endpoint. Causes: wrong URL/port, service not started, blocking Security Group, VPC routing issue, or external service down.


Question 28​

What is the "socket timeout" error in Lambda?

A) The socket is broken
B) The connection to an external service takes too long (no response)
C) Lambda timed out
D) The VPC is misconfigured

See the answer

Answer: B

Socket timeout means the external service does not respond within the client's configured timeout. Causes: slow or overloaded service, network issue, blocking Security Group/NACL, or misconfigured client timeout.


Question 29​

How to see a Lambda function's errors in real-time?

A) Impossible
B) CloudWatch Logs Live Tail, CloudWatch Logs Insights, or aws logs tail
C) Via email
D) In S3

See the answer

Answer: B

Use CloudWatch Logs Insights for real-time queries, "Live Tail" in the console to stream logs, or aws logs tail /aws/lambda/function-name --follow to follow from the CLI.


Question 30​

What is the best practice for logging in Lambda?

A) Do not log
B) Use structured JSON, include requestId, log levels, and useful context
C) Log everything
D) Only errors

See the answer

Answer: B

Best practices: use structured JSON for easier queries, include requestId (context.aws_request_id) for tracing, use levels (INFO, ERROR), log useful context without sensitive data, and avoid excessive logs (cost).


Result​

Count your correct answers:

  • 27-30: Excellent - You master Lambda troubleshooting
  • 22-26: Good - Some points to review
  • 17-21: Average - Review the course before the lab
  • Less than 17: Insufficient - Retake the course from the beginning

Proceed to the Lambda Troubleshooting Lab once you have achieved at least 22 correct answers.