amazon ec2 instance unable to resolve host
Check and compare /etc/resolv.conf
(for Linux instances) between working and non-working hosts. here is info from my Linux instance:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTENnameserver 10.0.0.2search us-west-2.compute.internal
In case of Windows instances, check and compare the output of ipconfig /all
command for DNS entries between working and non-working hosts. here is info from my windows instance:
Windows IP Configuration Host Name . . . . . . . . . . . . : WIN-************ Primary Dns Suffix . . . . . . . : Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No DNS Suffix Search List. . . . . . : us-west-2.ec2-utilities.amazonaws.com ec2.internal us-east-1.ec2-utilities.amazonaws.com compute-1.internal us-west-2.compute.internalEthernet adapter Local Area Connection: Connection-specific DNS Suffix . : us-west-2.compute.internal Description . . . . . . . . . . . : Citrix PV Ethernet Adapter #0 Physical Address. . . . . . . . . : 02-E6-AB-83-C6-8A DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes IPv4 Address. . . . . . . . . . . : 10.0.0.251(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Lease Obtained. . . . . . . . . . : Friday, March 21, 2014 11:36:17 AM Lease Expires . . . . . . . . . . : Tuesday, March 25, 2014 5:07:59 AM Default Gateway . . . . . . . . . : 10.0.0.1 DHCP Server . . . . . . . . . . . : 10.0.0.1 DNS Servers . . . . . . . . . . . : 10.0.0.2 NetBIOS over Tcpip. . . . . . . . : Disabled
If you’re not using the default VPC, or a VPC created by the VPC wizard, you’ll need to make sure that the DNS hostname
and DNS resolution
options are enabled.
I was able to fix it after enabling that service:
sudo systemctl enable --now systemd-resolved.service