EC2 t2.micro instance has no public DNS
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! :-)
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.
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.
Also check:
VPC -> Subnets -> Subnet Actions -> Modify Auto-Assign Public IP