How do I troubleshoot consistent and intermittent DNS-related errors in AWS Lambda?

2 minute read

I see DNS-related errors in my AWS Lambda function when I attempt to reach a host.


DNS-related errors in AWS Lambda, like Temporary failure in name resolution, getaddrinfo, ENOTFOUND, and ETIMEDOUT, can be consistent or intermittent. The troubleshooting process for consistent errors is different from the intermittent error troubleshooting process.

Troubleshooting consistent DNS-related errors

Misconfigured DNS servers, incorrect permissions, and network connectivity issues can cause consistent DNS-related errors. Take the following steps to troubleshoot consistent DNS-related errors:

  • When you're accessing public resources with a virtual private cloud (VPC)-configured Lambda function, verify that the Lambda function has internet access.
  • When you're accessing private resources, verify that the correct VPC and DNS servers are configured for the Lambda function.
  • When you're using custom DHCP option sets for a VPC, verify the DNS query response through Amazon Route 53 Resolver Query Logs.
  • Run your Amazon Elastic Compute Cloud (Amazon EC2) instance with the same network configuration as AWS Lambda. Then verify that you can resolve and reach the endpoint.
  • Verify that the hostname is correct for ENOTFOUND errors.
  • Try to access the target using an IP address instead of the hostname. This way, you can confirm whether the issue is caused by the hostname resolution or a missing endpoint route.
  • Make sure that the Lambda function's security group and network access control list (network ACL) allow inbound traffic to the necessary ports and IP ranges.

Troubleshooting intermittent DNS-related errors

Network congestion, high traffic, and other external factors can cause intermittent DNS-related errors. Take the following steps to troubleshoot intermittent DNS-related errors:

Related information

How does DNS work and how do I troubleshoot partial or intermittent DNS failures?

AWS OFFICIALUpdated a year ago