Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

EC2 t2.micro instance has no public DNS

I launched an Amazon Web Service (AWS) EC2 Instance, t2.micro, which must be launched into a VPC. The VPC has Auto-assign Public IP set to Yes. DNS resolution: Yes DNS hostnames: Yes But on the EC2 Dashboard, the instance still has a blank Public DNS and Public IP. I have tried to restart the instance several times, but it still has not been assigned a Public IP. The 5 Elastic IPs that came with our AWS account have already been used. It possible to get a Public IP assigned to a t2.micro instance without using Elastic IP?

2 Answers

0 votes
by (44.4k points)

Based on the data you provided, I cannot be 100% sure my answer is correct, but here is a thought.

The most common reason for no public IP address for your EC2 instance is that you are launching your EC2 instance using a private subnet. A private subnet means any EC2 instances located in that subnet aren't directly addressable from the public web. In different words, by definition, EC2 instances in a private subnet cannot have a public IP address.

This would justify why checking "public IP address" has no impact, and why you are unable to assign an Elastic IP address.

You can't simply relocate an instance from one subnet to another. If you wish to do that, you'll create an AMI of your instance (right-click on the EC2 instance and click on create image), and then launch a new instance from that AMI in a different subnet.

To determine if your subnet is private, look into the Route Table and see if you've got an internet gateway route. Go to VPC > Subnets > choose a Subnet > Route Table tab. Look for an entry that has something like igw-***. If you see this, it's a public subnet. If you see one thing like eni-*** / i-***, it is a private subnet.

0 votes
by (2.8k points)

Right-click on the VPC  in the VPC management console page and select "EDIT DNS Hostname". Set it to "Yes" in all the instances that are using the same VPC for seamless communication.

When you are creating the new instance in "Step 3: Configure Instance Details", enable the "Auto-assign Public IP".

Related questions

0 votes
1 answer
Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...