EC2 instance has no public DNS

后端 未结 18 1231
-上瘾入骨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:56

    I tried to fix the 'no public DNS' once the EC2 was up and running, I couldnt add a public DNS

    this is even after following the above steps making mods to the VPC or the Subnet

    so, I had to make modifications to the subnet and the vpc, before starting another instance, and THEN start up a new instance.

    the new instance had a public DNS. That is how it worked for me.

    0 讨论(0)
  • 2020-12-22 17:00

    First of all, there can be two reasons for this:

    1. You have created your own VPC and forgot to enable Public DNS.

    To solve this :

    i) Go to AWS VPC console and select the VPC you have created.

    ii) Then click on Actions and then enable DNS Resolution.

                OR
    
    1. You have not enabled public ip-assign option in EC2 configuration.

    Here you cannot change the setting; so create an ami image and then recreate the instance from that.

    0 讨论(0)
  • 2020-12-22 17:01

    In my case I found the answer from slayedbylucifer and others that point to the same are valid.
    Even it is set that DNS hostname: yes, no Public IP is assigned on my-pvc (only Privat IP).

    It is definitely that Auto assign Public IP has to be set Enable.
    If it is not selected, then by default it sets to Use subnet setting (Disable)

    0 讨论(0)
  • 2020-12-22 17:02

    If the instance is in VPC, make sure both "DNS resolution" and "DNS hostnames" is set to "yes". You can do this in the Aws console UI. HTH!

    0 讨论(0)
  • 2020-12-22 17:06

    You don't have to assign public ip address to your instance. you can use NAT instances or NAT Gateway.

    https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Scenario2.html https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-comparison.html

    0 讨论(0)
  • 2020-12-22 17:08

    For those using CloudFormation, the key properties are EnableDnsSupport and EnableDnsHostnames which should be set to true

    VPC: {
        Type: 'AWS::EC2::VPC',
        Properties: {
          CidrBlock: '10.0.0.0/16',
          EnableDnsSupport: true,
          EnableDnsHostnames: true,
          InstanceTenancy: 'default',
          Tags: [
            {
              Key: 'env',
              Value: 'dev'
            }]
        }
      }
    
    0 讨论(0)
提交回复
热议问题