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?
Trap 1: The function is experiencing cold starts due to high concurrency.
Cold starts add latency at invocation, not the sustained 30-second timeouts described, and high concurrency does not itself cause them. It tempts because cold-start latency is a well-known Lambda performance issue, and would fit if the symptom were sporadic slow first invocations rather than timeouts.
Trap 2: The function is hitting the maximum concurrent execution limit.
Concurrency limits cause throttling with 429 TooManyRequestsException errors, not invocation timeouts, since Lambda rejects excess requests rather than letting them run. It tempts because concurrency is a common Lambda scaling concern, and would be correct if the symptom were throttled invocations under burst load.
Trap 3: The function needs to be attached to a public subnet.
Lambda functions in a VPC never require a public subnet; they need NAT or endpoints for outbound internet, and a public subnet does not fix timeouts. It tempts because public subnets are associated with internet reachability, and would be relevant if the function needed direct inbound internet access.
- A
The function is experiencing cold starts due to high concurrency.
Why it fails: Cold starts add latency at invocation, not the sustained 30-second timeouts described, and high concurrency does not itself cause them. It tempts because cold-start latency is a well-known Lambda performance issue, and would fit if the symptom were sporadic slow first invocations rather than timeouts.
- B
The function is hitting the maximum concurrent execution limit.
Why it fails: Concurrency limits cause throttling with 429 TooManyRequestsException errors, not invocation timeouts, since Lambda rejects excess requests rather than letting them run. It tempts because concurrency is a common Lambda scaling concern, and would be correct if the symptom were throttled invocations under burst load.
- C
The function needs to be attached to a public subnet.
Why it fails: Lambda functions in a VPC never require a public subnet; they need NAT or endpoints for outbound internet, and a public subnet does not fix timeouts. It tempts because public subnets are associated with internet reachability, and would be relevant if the function needed direct inbound internet access.
- D
The function does not have a NAT gateway or VPC endpoints to access external resources.
A Lambda function in a private subnet has no route to the internet without a NAT gateway, and no path to AWS services without VPC endpoints. Calls to external order-processing resources therefore hang until the 30-second timeout expires, producing the intermittent failures described.