EC2 instance has no public DNS

后端 未结 18 1230
-上瘾入骨i
-上瘾入骨i 2020-12-22 16:26

A guy I work with gave me the EC2 credentials to log onto his EC2 console. I was not the one who set it up. Some of the instances show a public dns name and others have a bl

相关标签:
18条回答
  • 2020-12-22 16:47

    Here I will summarize the most common issues that occur:

    When you create a custom VPC, if you want aws resources such as ec2 instances to acquire public IP addresses so that the internet can communicate with them, then you first must ensure that the ec2 instance is associated with a public subnet of the custom VPC. This means that subnet has an internet gateway associated with it. Also, you need to ensure that the security group of the VPC associated with ec2 instance has rules allowing inbound traffic to the desired ports, such as ssh, http and https. BUT here are some common oversights that still occur:

    1) You must ensure that DNS hostnames is enabled for the VPC

    2) You must ensure the public subnet linked to the EC2 instance has its 'auto-assignment of public ip' flag enabled

    3) If the instance is already created, then you might need to terminate it and create a new instance for the public IP and public DNS fields to be populated.

    0 讨论(0)
  • 2020-12-22 16:48

    For me problem was in subnet settings.

    1. Open https://console.aws.amazon.com/vpc
    2. Go to subnets in left menu
    3. Choose your subnet
    4. Modify auto-assigning IP settings to enable
    0 讨论(0)
  • 2020-12-22 16:48

    Just launch another instance (and also delete the one in question if it has no use) and make sure this time you check "Autoatically assign a public IP address to your instance". If not then as slayedbylucifer suggested; assign an Elastic IP (EIP) to the instance and then log in using that IP. Be careful though, if you are running the free AWS tier, an EIP will cost you money-- that's a whole 'nother topic..

    0 讨论(0)
  • 2020-12-22 16:50

    This is the tip provided to resolve the issue which does not work:

    Tip - If your instance doesn't have a public DNS name, open the VPC console, select the VPC, and check the Summary tab. If either DNS resolution or DNS hostnames is no, click Edit and change the value to yes.

    Assuming you have done this and you are still not getting a Public IP then go over to the subnet in question in the VPC admin screen and you will probably discover "Auto-Assign Public IP" is not set to yes. Modify that setting then, and I know you don't want to here this, create a new instance in that subnet. As far as I can tell you cannot modify this on the host, I tried and tried, just terminate it.

    0 讨论(0)
  • 2020-12-22 16:53

    After verifying VPC and Subnet settings, my EC2 instance still didn't have a public DNS. After a day of searching for a resolution, I finally figured it out.

    I had to create a new Elastic IP address, then associate it to my instance.

    From the EC2 Dashboard:

    Go to Elastic IPs from the sidebar.

    Click Allocate new address, then Allocate.

    Go back to the EC2 Dashboard. Go to Network Interfaces.

    Select the EC2 instance without a public DNS. Then Actions - Associate Address.

    The Address field, select the new elastic IP address.

    The Associate to private IP address field, select the private IP address with no public DNS.

    Click Associate Address.

    Your EC2 instance should now have a public DNS.

    0 讨论(0)
  • 2020-12-22 16:55

    It is related to the VPC's feature called "DNS Hostnames". You can enable or disable it. Go to the VPC, under the Actions menu select the "Edit DNS Hostnames" item and then choose "Yes". After doing so, the public DNS of the EC2 instances should be displayed.

    0 讨论(0)
提交回复
热议问题