I have this issue on AWS on Ubuntu 16.04-amd64-server. Whenever I run sudo the terminal is stuck doing seemingly nothing, giving me the following error:
root@ip-10-20-54-234:/home# sudo -s sudo: unable to resolve host ip-10-20-54-234
I fixed this problems temporarily by adding `127.0.1.1 ip-10-20-54-234 /etc/hosts.
I understand when you associate an elastic IP address with an instance, that becomes its public IP address. The original IP address is no longer usable also if you take the elastic IP address away from the instance it will get a new public IP address that will likely be different from the original one.
However, there is clearly a problem. Even though I can connect to the machine with the newly assigned elastic address, it seems that my EC2 instance keeps the old orginal one somewhere but it keeps displaying it as the prompt and putting this weird message when I use sudo!
However, I'm looking for permanent solution to resolve that.