Skip to content

How do I troubleshoot Lambda DNS related errors?

3 minute read
0

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

Resolution

DNS related errors in Lambda like "Temporary failure in name resolution," "getaddrinfo," "ENOTFOUND," and "ETIMEDOUT" are either consistent or intermittent depending on your network environment.

Troubleshoot consistent DNS related errors

Misconfigured DNS servers, incorrect permissions, and network connectivity issues might cause consistent DNS related errors.

Complete the following actions:

  • If you access public resources with a Lambda function that has an Amazon Virtual Private Cloud (Amazon VPC) connection, then check your configuration requirements. Make sure that the Lambda function has internet access.
  • If you access private resources, then verify that you configured the correct VPC and DNS servers for the Lambda function.
  • When you use custom Dynamic Host Configuration Protocol (DHCP) option sets in a VPC, make sure that you verify the DNS response. Use Amazon Route 53 Resolver query logs to verify the DNS query response.
  • Run your Amazon Elastic Compute Cloud (Amazon EC2) instance with the same network configuration as Lambda. Then, verify that you can resolve and reach the endpoint.
  • For "ENOTFOUND" errors, verify that the hostname is correct.
  • Use an IP address instead of the hostname to access the target. This way, you can confirm whether the hostname resolution or a missing endpoint route causes the issue.
  • Make sure that the Lambda function's security group and network access control list (network ACL) allow inbound traffic to the required ports and IP ranges.
  • For "UNKNOWNHOSTEXCEPTION" errors, your function might have reached the maximum of 20 concurrent TCP connections for DNS resolution. If your Lambda function is falling back to TCP DNS because of large DNS payloads, then confirm that your solution uses libraries that support EDNS. For more information, see DNS: Fail to connect to hosts with UNKNOWNHOSTEXCEPTION.

Troubleshooting intermittent DNS related errors

Network congestion and high network traffic might cause intermittent DNS related errors. 

Complete the following actions:

Related information

How do I troubleshoot partial or intermittent DNS failures related to Amazon VPC?

Troubleshoot networking issues in Lambda

AWS OFFICIALUpdated 3 days ago