Unable to Resolve Host ip-10-0-0-58

Unable to resolve host ip-10-0-0-58 or any other number after the “ip” is a common error that I receive every single time I am trying to run as root in a spun up EC2 instance.  There is a simple solution but I have to look it up everytime.  When that happens I just put it here so I don’t actually have to search for it.

All you have to do is edit your hosts file.

  1. Type in “sudo nano /etc/hosts” or use whatever program you prefer like vi instead of nano.
  2. On the line below localhost enter in this info: 127.0.0.1 ip-10-0-0-58
  3. Use whichever number that corresponds to your instance.  This particular instance ends in 58 but your instance could end with any other number.
  4. save it and your done!