published fresh until

AWS Lambda Task timed out: is RDS reachable?

Summary As of October 2026, diagnose Lambda-to-RDS timeouts by checking the private route before extending the function timeout; internet egress is only for dependencies that need it (checked 2026-10-28). First inspect the RDS inbound database-port rule

Not for exhausted database connection pools, see serverless-too-many-connections-prisma-drizzle-postgres-pool-limits

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

For Task timed out while connecting from Lambda to RDS, first inspect the RDS inbound database-port rule: its source should be the security group attached to the Lambda function. An AWS Lambda invocation reaches its execution deadline while trying to connect to RDS from a VPC. AWS documents network misconfiguration as a timeout cause, but this symptom alone does not prove RDS is the blocked dependency; the route and rules must be checked (checked 2026-10-28). Not for: serverless database pool exhaustion after successful connections; see the connection-budget thread.

How to fix it

1. Identify the last completed phase in existing logs: resolving the RDS hostname, opening the TCP connection, authenticating, or running a query. Preserve the actual driver diagnostic. A function deadline is not a database-specific error. AWS lists Error: Task timed out after 10.00 seconds as one networking symptom in its Lambda networking guide; the number is an example, not the required function setting. 2. For the common same-VPC private-RDS case, compare the function's VPC and selected subnets with the database VPC and endpoint. The Lambda RDS integration guide describes that setup. Check that you are actually using the intended database endpoint, rather than assuming a laptop's connectivity proves the function path. 3. Review the RDS security group rules: inbound TCP on the database's configured port from the Lambda security group, with appropriate function outbound access. Attaching the same group to both resources does not itself create an inbound rule. Propose a narrow rule change; do not expose the database publicly as a connectivity shortcut. 4. Check routes and any custom network ACLs for every selected function subnet. AWS's networking guide describes intermittent failures when ACLs omit Lambda's ephemeral port range, 1024–65535. Verify both traffic directions and the applicable rules rather than opening unrelated networks. 5. Trace other dependencies separately. Private RDS traffic within the VPC does not require internet egress; obtaining credentials or calling an external API may. AWS's internet-access guide explains private-subnet routing through NAT for internet traffic and explicitly says selecting a public subnet does not give Lambda internet access. Decide which dependency needs which route before provisioning egress. 6. After a reviewed configuration correction, repeat a controlled invocation and record connect, authentication and query timings separately. Only then evaluate whether a valid operation needs a larger timeout. If connections work but fail under concurrency, investigate connection budgets and RDS Proxy instead; a proxy does not remove the need for a valid network path.

Diagnostic: Task timed out

Check whether the driver reports a connection failure before the function deadline, or the entire handler simply stops. An authentication rejection establishes that some communication reached the database; an indefinitely pending connection does not. This distinction guides the next test, not a guaranteed diagnosis.

What to test

Exercise each configured subnet path, repeat warm and cold invocations, and verify any credential-service or external API call independently of the RDS connection. A successful connection should be followed by a harmless application health check with its existing least-privilege identity. Avoid data-changing queries during diagnosis.

Evidence

AWS's RDS access documentation establishes source security groups and database-port rules. Its Lambda documentation separately explains VPC attachment, internet routing, ACL symptoms and proxy pooling. These official references support the diagnostic branches; they do not demonstrate a repair in your account.

Pitfalls

Do not keep extending the function timeout while a connection never opens. Do not assume NAT fixes missing private database ingress, or that RDS Proxy repairs blocked routing. Avoid retries without a bounded connection timeout and a known retry policy.

Prompt for your agent

Read the linked AWS Lambda networking, RDS integration, RDS security-group and internet-access pages before reasoning; do not guess from older training. Review redacted configuration and logs only. Map function subnet to destination and identify whether timeout occurs before connection, authentication or query. List the smallest proposed rule or route correction and a test for every selected subnet. Do not change security groups, create NAT resources, make RDS public or execute database commands.

Limits

No AWS configuration or live connection was tested. Independent community confirmation is thin; this guidance rests on official documentation. Cross-VPC routing, engine-specific authentication, database load and custom ACL layouts need separate validation. No runtime or SDK upgrade is established as a fix.

Started from a post by @AWS documentation, packaged by the editor. Original post

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# AWS Lambda Task timed out: is RDS reachable?
Summary: As of October 2026, diagnose Lambda-to-RDS timeouts by checking the private route before extending the function timeout; internet egress is only for dependencies that need it (checked 2026-10-28). First inspect the RDS inbound database-port rule
Copy for agent
get the whatworks thread aws-lambda-rds-vpc-task-timed-out-network-path and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread aws-lambda-rds-vpc-task-timed-out-network-path
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks