EC2 t2.micro instance has no public DNS

2019-03-09 19:17发布

EC2 t2.micro instance has no public DNS

I lanunched an Amazon Web Service (AWS) EC2 Instance, t2.micro, which must be launced 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 it possible to get a Public IP assigned to a t2.micro instance without using Elastic IP?

I have read the post: EC2 instance has no public DNS, but I do not have reputation points to be able to add a comment, so I am posting this as new question.

6条回答
神经病院院长
2楼-- · 2019-03-09 19:42

I had the same issue. The reason of my issue turned out to be that I was using a route table which was not associated with a subnet.

enter image description here

After I changed my subnet, my instances were assigned public ips.

查看更多
【Aperson】
3楼-- · 2019-03-09 19:54

Also check: VPC -> Subnets -> Subnet Actions -> Modify Auto-Assign Public IP

查看更多
仙女界的扛把子
4楼-- · 2019-03-09 19:56

There are many possible reasons. Check the follow.

You need to have a VPC created.

The DNS resolution and DNS hostnames should be enabled.

Choose your VPC -> Actions -> Edit DNS resolution -> enable Choose your VPC -> Actions -> Edit DNS hostnames -> enable

Into the VPC maybe you need a private and public subnet.

In the private subnet, you need to have a NAT Gateway associate to this. In the public subnet, you need to have an Internet Gateway associate to this.

You need to enable the auto-assign IP for your public subnet. Choose the public subnet -> Actions -> Modify auto-assign IP settings -> enable

Later when you launch a new instance in Step 3: Configure Instance Details.

You should choose your VPC and your public subnet. And in the "Auto-assign Public IP" section choose "Use subnet setting (Enabled)"

I think that that should solve your problem...

查看更多
劫难
5楼-- · 2019-03-09 20:01

Based on the information you provided, I can't be 100% sure my answer will be correct, but here is a thought.

The most common cause of no public IP address for your EC2 instance is that you're launching your EC2 instance in a private subnet. A private subnet means that any EC2 instances located in that subnet are not directly addressable from the public Internet. In other words, by definition, EC2 instances in a private subnet cannot have a public IP address.

This would explain why checking "public IP address" has no effect, and why you're unable to assign an Elastic IP address.

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

To determine if your subnet is private, look at the Route Table and see if you have an Internet Gateway route. Go to VPC > Subnets > Select 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 something like eni-*** / i-***, it's a private subnet.

查看更多
不美不萌又怎样
6楼-- · 2019-03-09 20:02

Rightclick on the VPC row in the VPC management console page and select "EDIT DNS Hostname". Set it to "Yes". It´s necessary to allow all the instances with the same VPC.

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

That´s it! :-)

查看更多
我只想做你的唯一
7楼-- · 2019-03-09 20:07

Face the same issue today. My EC2 instance has no public DNS thus I'm unable to connect via ssh.

I tried and success with these steps:

  • Go to VPC > Internet Gateways: make sure an Internet Gateway is created and attached to the EC2's VPC

  • Goto VPC > Route Tables, select a VPC route, navigate to Routes tab: add a new rule with

++ Destination: 0.0.0.0/0

++ Target: select the created Internet Gateway

  • Goto VPC > Subnet > Route Table tab: click edit, change to the Route Table with destination 0.0.0.0/0 above

Done.

查看更多
登录 后发表回答