EC2 Instance Temporary failure in name resolution/Empty resolv.conf file

1

I had a working ec2 instance, but have not logged into it for some time. I wanted to re-visit an old project and when I logged in via ssh I noticed that the storage space had filled up. I am using an influxdb database together with grafana and telegraf, and when attempting to clear up some storage space I started running into this "unable to resolve host ip-<iphere>: Temporary failure in name resolution" when trying to execute some commands. Upon further inspection after not being able to "ping google.com" (" Temporary failure in name resolution" error again) I saw that the /etc/resolv.conf file was completely empty, and it seems that the dhclient did not create this file upon startup of the instance.

I have tried rebooting the instance and stopping and starting the instance, but neither of these worked. Could somebody please give some advice on what to try next?

  • Im also in a similar situation where, after relaunching (and giving more space to my volume to avoid that no space left on device error) and reconnection with terminal I had to add this line "127.0.0.1 ip-NEW.IP.NUMBER" on /etc/hosts in order to recognize the "sudo" command. anyway Im also getting those kind of problems and also getting this "ping google.com" (" Temporary failure in name resolution" error again)

asked 2 years ago5996 views
1 Answer
0

It seems to me that you might be experiencing issues with your resolv.conf file. Alternatively, you might need to set a static DNS resolver.

Reference this link for detailed steps: https://aws.amazon.com/premiumsupport/knowledge-center/ec2-static-dns-ubuntu-debian/

If you are trying to have DHCP generate the /etc/resolv.conf file when starting/stopping the server, make sure to check your network configuration scripts to ensure that PEERDNS=yes.

Cheers!

answered 2 years ago
AWS
SUPPORT ENGINEER
reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions