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:
- Instances with a public IP address receive corresponding public DNS hostnames.
- The Amazon Route 53 Resolver server can resolve Amazon-provided private DNS hostnames.
If either or both of the attributes is set to false, the following occurs:
- Instances with a public IP address do not receive corresponding public DNS hostnames.
- The Amazon Route 53 Resolver cannot resolve Amazon-provided private DNS hostnames.
- Instances receive custom private DNS hostnames if there is a custom domain name in the DHCP options set. If you are not using the Amazon Route 53 Resolver server, your custom domain name servers must resolve the hostname as appropriate.
If enableDnsHostnames
and enableDnsSupport
are true
then check if the DHCP option set is modified.
- Go to the VPC service page in the AWS Console. Select
Your VPCs
to see all the VPCs.
- Select the VPC, and select
Actions
, Edit DHCP options set
.
- In the DHCP options set list, select the default DHCP option list, and then choose Save.
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.
- Windows:
ipconfig /renew
- Linux:
sudo dhclient -r
Or restart the instance, if you can't wait.