Cloud Technology

Why does my AWS EC2 instance have a Public IP but no Public DNS name assigned?

MA Asked by Marcus Thorne · 19-01-2026
0 upvotes 18,339 views 0 comments
The question

I just launched a new EC2 instance in a custom VPC, and while I can see a public IP address, the "Public IPv4 DNS" field in the AWS Console is completely blank. This is preventing me from using the DNS name for my web server configuration. I’ve checked that the instance is in a public subnet and has an Internet Gateway attached to the route table. Are there specific VPC-level attributes that I need to enable to get AWS to generate the public hostname?

3 answers

0
DA
Answered on 21-01-2026

The most common reason an EC2 instance lacks a public DNS name is that the DNS Hostnames attribute is disabled at the VPC level. By default, custom VPCs often have this setting turned off. To fix this, go to the VPC Dashboard, select your VPC, click on Actions, and then Edit VPC settings. Ensure that both Enable DNS support and Enable DNS hostnames are checked. Once these are enabled, AWS will automatically assign a public DNS name to any instance that has a public IP address. Note that you do not need to restart the instance; the DNS name should appear in the console within a few seconds of updating the VPC settings.

0
JU
Answered on 23-01-2026

If you have already enabled those VPC settings and still don't see the DNS name, check if your instance actually has a Public IP. If the instance was launched without the "Auto-assign Public IP" setting enabled, it won't receive a Public DNS name because there is no public address to map it to. In this case, you would need to associate an Elastic IP (EIP) with the instance. Once the EIP is attached, the Public DNS name should generate automatically using the EIP's address format.

ST 25-01-2025

Justin makes a great point. I’ve also noticed that if you are using a strictly private subnet with a NAT Gateway, you will never get a Public DNS. The DNS hostname is specifically tied to the public-facing side of the network. If your architecture requires public access, make sure your subnet's Route Table has a path (0.0.0.0/0) leading to an Internet Gateway (IGW), otherwise the "Public" part of the DNS won't trigger.

0
RE
Answered on 28-01-2026

It's almost always the VPC setting. Just a heads-up: if you are using a CLI or Terraform to build your VPC, you have to explicitly set enable_dns_hostnames = true, as it defaults to false in many automated scripts.

MA 30-01-2026

Thanks Rebecca! I checked my Terraform code and that was exactly the issue. I added the attribute, ran terraform apply, and the DNS names appeared instantly across all my instances.

Share your thoughts

Your email address will not be published. Required fields are marked (*)

Professional Counselling Session

Still have questions?
Schedule a free counselling session

Our experts are ready to help you with any questions about courses, admissions, or career paths. Get personalized guidance from industry professionals.

Request a Call Back

Search Online

We Accept

We Accept

Follow Us

"PMI®", "PMBOK®", "PMP®", "CAPM®" and "PMI-ACP®" are registered marks of the Project Management Institute, Inc. | "CSM", "CST" are Registered Trade Marks of The Scrum Alliance, USA. | COBIT® is a trademark of ISACA® registered in the United States and other countries.

Book Free Session