8

I have a non-default vpc where i want to launch instances. The docs http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-vpc.html say:

Non-default vpc: "DNS hostnames are disabled by default."

Currently there is no option to set in during ec2-launch with "aws ec2 run-instances".

http://docs.aws.amazon.com/cli/latest/reference/ec2/run-instances.html

Any idea?

Jens Zastrow
  • 287
  • 1
  • 3
  • 9

2 Answers2

10

To enable DNS resolution and DNS hostnames for your VPC, open the VPC Management Console > Your VPCs. Click on your VPC and then click on Actions and then enable both Edit DNS Resolution & Edit DNS Hostnames.

enter image description here

captainblack
  • 4,107
  • 5
  • 50
  • 60
  • When this option is disabled, would this prevent dns resolution within the VPC? – mTheSame Feb 04 '20 at 15:44
  • If either or both of the attributes is set to false, the following occurs: >Instances with a public IP address do not receive corresponding public DNS hostnames. >The Amazon-provided DNS server cannot resolve Amazon-provided private DNS hostnames. >Instances receive custom private DNS hostnames if there is a custom domain name in the DHCP options set. If you are not using the Amazon-provided DNS server, your custom domain name servers must resolve the hostname as appropriate. – captainblack Feb 04 '20 at 20:18
  • I'm facing some issues with private DNS, when I `dig` any address within the VPC (non-default), I don't get a `answer section`. I've tried to resolve the names from the default VPC, and I works. I've read in some AWS articles that I can't prevent DNS server access by Security Groups, ACL ou prevent routes to it. But what could be the problem? – mTheSame Feb 05 '20 at 09:20
3

DNS resolution is on a per-VPC basis, not per-instance. You can enable DNS hostnames by finding the VPC in the VPC management console and Enabling DNS hostname support.

enter image description here

Ben Whaley
  • 32,811
  • 7
  • 87
  • 85