Courseiva
Continuous Improvement for Existing SolutionshardMultiple ChoiceObjective-mapped

SAP-C02 Lambda VPC Access Practice Question

A company uses AWS Lambda functions within a VPC to process data from an Amazon SQS queue. The Lambda functions frequently timeout with the error 'Task timed out after 3.00 seconds'. The functions perform database operations on an RDS instance in the same VPC. The average database query takes 2 seconds. What is the MOST likely cause of the timeouts?

⚠ Common exam trap

The timeout occurs because the Lambda function cannot reach the SQS API from within the VPC without a NAT gateway or VPC endpoint. The database query time is irrelevant here.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

The VPC does not have a NAT gateway, so the Lambda function cannot poll the SQS queue.

Lambda functions in a VPC require a NAT gateway or VPC endpoints to access the SQS API, which is outside the VPC. Without a NAT gateway, the function cannot poll the SQS queue, causing timeouts. Option A is wrong because Lambda can access RDS within the same VPC without special permissions. Option C is wrong because the timeout is due to SQS polling failure, not the database query time. Option D is wrong because the RDS instance is under-provisioned would cause slow queries, but the error is a timeout after exactly 3 seconds, indicating the function is waiting on something else (SQS polling).

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The Lambda function does not have the required VPC permissions to access the RDS instance.

    Why it's wrong here

    Lambda in a VPC can access RDS via the VPC without extra permissions; the issue is with SQS access.

  • The VPC does not have a NAT gateway, so the Lambda function cannot poll the SQS queue.

    Why this is correct

    Lambda in a VPC needs a NAT gateway to access public endpoints like SQS; without it, SQS polling fails, causing timeouts.

  • The Lambda function timeout should be increased to accommodate database query time.

    Why it's wrong here

    The query time is 2 seconds, which is within the 3-second timeout; the issue is network connectivity to SQS.

  • The RDS instance is under-provisioned and causing slow queries.

    Why it's wrong here

    The query time is 2 seconds, which is acceptable; the timeouts are due to SQS polling failure.

Visual reference

Inside (Private) PC-A 10.0.0.1 PC-B 10.0.0.2 NAT Router Outside (Public) 203.0.113.1 Inside Global Server PAT: many private IPs share one public IP via unique port numbers

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

One of 1,660 original SAP-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way this is tested on SAP-C02

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A company runs a production AWS Lambda function that processes orders. Recently, the function has been timing out occasionally. The function uses a VPC with a single private subnet and has a timeout of 30 seconds. What is the MOST likely cause of the timeout?

medium
  • A.The function is experiencing cold starts due to high concurrency.
  • B.The function is hitting the maximum concurrent execution limit.
  • C.The function needs to be attached to a public subnet.
  • D.The function does not have a NAT gateway or VPC endpoints to access external resources.

Why D: The most likely cause of the timeout is that the Lambda function is attached to a VPC but does not have a NAT gateway or VPC endpoints to access external resources (Option D). When a Lambda function is configured to run in a VPC, it loses default internet access. To access external services (such as an external database or API), the function needs a NAT gateway in a public subnet or VPC endpoints for the specific services. Without this, the function will timeout when trying to reach external resources. Option A is incorrect because cold starts cause latency but not consistent timeouts. Option B is incorrect because hitting the concurrent execution limit would cause throttling (HTTP 429 or 500 errors), not timeouts. Option C is incorrect because attaching to a public subnet would not help; Lambda functions cannot have public IPs in a VPC by default, and a public subnet does not provide internet access without an internet gateway and route table updates.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This SAP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SAP-C02 exam.