Skip to main content
This guide demonstrates how the two VPC DNS settings in AWS — “Enable DNS resolution” and “Enable DNS hostnames” — affect EC2 instances. You’ll see how these toggles determine whether instances can resolve DNS using the Amazon-provided DNS server and whether instances with public IPs receive public DNS hostnames. Keywords: AWS VPC DNS, AmazonProvidedDNS, Enable DNS resolution, Enable DNS hostnames, EC2 public DNS

VPC DNS settings overview

When you select a VPC and choose Actions → Edit VPC settings, there are two key toggles:
  • Enable DNS resolution — lets instances in the VPC use the Amazon-provided DNS server (AmazonProvidedDNS) to resolve hostnames.
  • Enable DNS hostnames — when enabled (and DNS resolution is also on), instances that have a public IPv4 address get a public DNS hostname.
Here is the VPC Edit settings view where these two toggles are located.
A screenshot of the Amazon Web Services VPC management console showing the "Edit VPC settings" page for a VPC (named "vpcdemo") with sections for DHCP, DNS, and network address usage metrics and Save/Cancel buttons.

Effect of “Enable DNS hostnames”

To illustrate DNS hostnames, I launched an EC2 instance named “dns-demo” with these choices during the launch workflow:
  • Selected the custom VPC (default DNS-related settings untouched)
  • Enabled auto-assign public IPv4 address
  • Selected a key pair for SSH
  • Created/used a security group allowing SSH (port 22) and ICMP (for ping)
The Security Group/launch screen used during instance creation looked like this:
A screenshot of the AWS EC2 "Launch an instance" page showing the security group creation form with inbound rules (SSH on port 22 open to Anywhere and ICMP) on the left and a summary panel for an Amazon Linux t2.micro instance with a "Launch instance" button on the right.
Initially, with the VPC’s “Enable DNS hostnames” turned off, the instance received only a private DNS name (resolvable inside the VPC) even though it had a public IPv4 address. After enabling “Enable DNS hostnames” (Actions → Edit VPC settings → enable and Save) and refreshing the EC2 console, the instance was assigned a public DNS hostname. Pinging that hostname resolved to the instance’s public IP:
The EC2 Instances view showing the running instance “dnsdemo” and its public IPv4 address:
Screenshot of the AWS EC2 Management Console showing the Instances view. It lists several EC2 instances (most terminated) with one running instance named "dnsdemo" selected, and its instance details (including a public IPv4 address) displayed.
Takeaway: “Enable DNS hostnames” controls assignment of public DNS hostnames to instances that have public IPv4 addresses — but it only does so when DNS resolution in the VPC is available.

”Enable DNS resolution” and the Amazon-provided DNS server

Next, we examine the AmazonProvidedDNS and the “Enable DNS resolution” toggle. SSH into the instance:
Amazon provides a DNS resolver inside each VPC. Its IP address is typically the VPC CIDR base + 2 (for a VPC with CIDR 10.0.0.0/16, the resolver is 10.0.0.2). The VPC console shows the VPC CIDR below:
A screenshot of the Amazon Web Services VPC console showing a list of VPCs and details for a selected VPC named "vpcdemo" (VPC ID vpc-0aca...), with its state marked Available and IPv4 CIDR 10.0.0.0/16. The left sidebar shows other VPC navigation options like Subnets, Route tables, and Internet gateways.
On the instance, the resolver configuration points to the Amazon DNS:
Using that resolver the instance can resolve public hostnames:
If you disable “Enable DNS resolution” for the VPC, the Amazon-provided DNS server will not respond. The instance’s /etc/resolv.conf may still list the Amazon DNS IP (e.g., 10.0.0.2), but queries will time out. To restore name resolution you must point the resolver to another reachable DNS server (for example, 8.8.8.8) or re-enable DNS resolution in the VPC. Example of a timed-out lookup after disabling DNS resolution:

Quick reference: VPC DNS toggles

Summary

  • Enable DNS resolution = makes the Amazon-provided DNS server in the VPC available to instances.
  • Enable DNS hostnames = permits assignment of public DNS hostnames for instances that have public IPv4 addresses (only meaningful if DNS resolution is enabled).
Note: For the AWS Solutions Architect exam, be sure you can explain and distinguish “Enable DNS resolution” (availability of AmazonProvidedDNS) and “Enable DNS hostnames” (assignment of public DNS names to public-IP instances).

Watch Video