How do I troubleshoot timeout issues with a Lambda function that's in an Amazon VPC?

Last updated: 2021-09-09

My AWS Lambda function returns timeout errors when I configure the function to access resources in an Amazon Virtual Private Cloud (Amazon VPC). How do I troubleshoot the issue?

Resolution

Confirm that there's a valid network path to the endpoint that your function is trying to reach. To review your network settings, follow the instructions in How do I give internet access to my Lambda function in a VPC?

Important: If you're using a custom Dynamic Host Configuration Protocol (DHCP) options set, confirm that your custom DNS server is working as expected.

When you review your network settings, make sure that the following settings are configured correctly:

Note: Security groups require outbound rules for Lambda only. Network ACLs require both inbound and outbound rules for Lambda.

If you're using an AWS SDK, then see if the SDK throws any relevant errors that can help you determine what's causing the timeouts.