I am new to Amazon Web Service (AWS)
I just created a VPC and and a subnet, which is inside it. However, I could not resolve any hostnames in this subnet (when I stay in any hosts in this subnet)
[ec2-user@ip-192-168-1-86 ~]$ nslookup
> ip-192-168-1-86.ec2.internal
Server: 192.168.1.2
Address: 192.168.1.2#53
** server can't find ip-192-168-1-86.ec2.internal: NXDOMAIN
I have double check that DNS resolution is enabled for my VPC and private DNS hostname is correct enter image description here
From the AWS DNS documentation
When you launch an instance into a VPC, it always receives a private DNS hostname.
The DNS resolution depends on the enableDnsHostnames
and enableDnsSupport
flags.
By default, both attributes are set to true in a default VPC or a VPC created by the VPC wizard. By default, only the enableDnsSupport attribute is set to true in a VPC created any other way.
Depending upon the enableDnsHostnames
and enableDnsSupport
flags following rules apply:
If both attributes are set to true
, the following occurs:
If either or both of the attributes is set to false, the following occurs:
If enableDnsHostnames
and enableDnsSupport
are true
then check if the DHCP option set is modified.
Your VPCs
to see all the VPCs.Actions
, Edit DHCP options set
.On the VPC service page, you can find the DHCP Options Sets where you can get the Default DHCP Options Sets.
It would take a couple of hours for the running EC2 instances to reflect this without a restart. You can also renew the IP lease by the following command.
ipconfig /renew
sudo dhclient -r
Or restart the instance, if you can't wait.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With