Error: “Failed to establish a new connection: [Errno -2] Name or service not known” when the Lambda in {Rigion} trying to connect to {URL}

After my investigation, it is said that the root cause could be a DNS resolution failure error in most cases.

So you can use dig command line to find out more details. For example, by using the command, dig {URL}, you are able to see if the URL resolves to IP address properly.

You can find more information for dig command from https://blog.ilearnaws.com2020/05/18/dig-command/

In addition, if you setup a private hosted zone in the Amazon Route 53 and the lambda is in a VPC, you may need to associate the VPC which the Lambda resides in with that private hosted zone. Then the Lambda should be able to connect to the host.

No Comments

Leave a Reply