Mastering Route 53 Private Hosted Zones
Using Route 53 private hosted zones
Mastering Route 53 Private Hosted Zones
Learning Objectives
After studying this guide, you should be able to:
- Differentiate between Public and Private Hosted Zones (PHZ).
- Describe the architectural requirements for associating a PHZ with one or more VPCs.
- Explain the role of Route 53 Resolver Endpoints in hybrid DNS architectures.
- Configure security groups and resource records to facilitate internal name resolution.
- Implement DNS query logging for auditing and troubleshooting.
Key Terms & Glossary
- Private Hosted Zone (PHZ): A container that holds information about how you want Amazon Route 53 to respond to DNS queries for a domain and its subdomains within one or more VPCs.
- VPC Association: The process of linking a PHZ to a specific Virtual Private Cloud so that instances within that VPC can resolve the records in that zone.
- Route 53 Resolver: The AWS-managed DNS service (formerly known as the ".2 resolver") that handles recursive DNS queries for VPC resources.
- Inbound Endpoint: A Resolver configuration that allows DNS queries from an on-premises network to your VPC.
- Outbound Endpoint: A Resolver configuration that allows VPC resources to forward DNS queries to on-premises DNS servers.
- Resource Record Set: Objects within the hosted zone (e.g., A, AAAA, CNAME) that map domain names to IP addresses or AWS resources.
The "Big Idea"
Route 53 Private Hosted Zones are the backbone of internal service discovery within AWS. While public zones allow the world to find your website, private zones ensure that your internal microservices, databases, and administrative tools can communicate using human-readable names (e.g., db.internal.corp) without exposing those names or their private IP addresses to the public internet. This provides a critical layer of security and architectural abstraction in complex enterprise environments.
Formula / Concept Box
| Feature | Requirement / Rule |
|---|---|
| Port Requirement | UDP/TCP Port 53 must be open in Security Groups for Resolver Endpoints. |
| VPC Settings | enableDnsHostnames and enableDnsSupport must be set to true. |
| Resolution Scope | PHZ records are only visible to the VPCs associated with the zone. |
| Global Nature | Route 53 is a global service, but PHZ resolution is scoped by VPC association. |
Hierarchical Outline
- I. Route 53 Hosted Zone Fundamentals
- Public Hosted Zones: Internet-facing, uses public IPs, automatic NS/SOA record creation.
- Private Hosted Zones: Internal-facing, uses private IPs, requires VPC association.
- II. Implementation of PHZs
- Creation: Defined via Console, CLI, or API.
- Association: Can support multiple VPCs across different accounts (via AWS RAM or CLI).
- Endpoints: Connecting to ELB, EC2, or custom IP endpoints.
- III. Hybrid DNS Architectures
- Inbound Endpoints: Queries flow: On-Premises $\rightarrow Route 53.
- Outbound Endpoints: Queries flow: Route 53 \rightarrow$ On-Premises.
- Forwarding Rules: Conditional logic to determine where queries are sent based on domain name.
- IV. Security & Monitoring
- Security Groups: Controlling access to Resolver Endpoints.
- Query Logging: Integrating with CloudWatch Logs for audit trails.
Visual Anchors
Internal Query Flow
This flowchart illustrates how a DNS query is handled within a VPC associated with a Private Hosted Zone.
Hybrid DNS Connectivity (TikZ)
This diagram shows the relationship between AWS VPC and On-Premises data centers using Resolver Endpoints.
\begin{tikzpicture}[node distance=2cm, every node/.style={font=\small}] \draw[thick, blue, dashed] (0,0) rectangle (5,4) node[pos=0.5, above=1.5cm] {AWS VPC}; \draw[thick, orange] (7,0) rectangle (12,4) node[pos=0.5, above=1.5cm] {On-Premises DC};
\node[draw, rounded corners] (EC2) at (1.5, 2) {EC2 Instance}; \node[draw, fill=blue!10] (RE) at (4, 2) {Resolver}; \node[draw, fill=orange!10] (DNS) at (9.5, 2) {Local DNS Server};
\draw[->, thick] (EC2) -- (RE) node[midway, above] {Query}; \draw[<->, thick] (4, 1) -- (8, 1) node[midway, below] {Outbound/Inbound Endpoint}; \draw[->, thick] (8, 1) -- (DNS); \end{tikzpicture}
Definition-Example Pairs
- Split-view DNS: A configuration where you use the same domain name for both internal and external traffic, but return different results.
- Example:
api.example.comresolves to a public ALB for internet users, but resolves to a private IP for internal developers within the VPC PHZ.
- Example:
- Conditional Forwarding: Using rules to send specific domain queries to specific servers.
- Example: Configuring a rule so that any query ending in
.corp.localis forwarded to the on-premises Active Directory DNS server via an Outbound Endpoint.
- Example: Configuring a rule so that any query ending in
- VPC Peering Resolution: Allowing DNS resolution across peered VPCs.
- Example: VPC A is peered with VPC B; by associating the PHZ with both VPCs, instances in VPC B can resolve names defined in VPC A's zone.
Worked Examples
Example 1: Creating and Associating a PHZ via CLI
Goal: Create a zone named internal.aws.training and associate it with VPC vpc-12345678.
- Create the Hosted Zone:
aws route53 create-hosted-zone --name internal.aws.training --vpc VPCRegion=us-east-1,VPCId=vpc-12345678 --caller-reference 2023-10-27-01 --hosted-zone-config Comment="Private zone for internal services",PrivateZone=true- Verify Association: Check the VPC settings to ensure
enableDnsSupportis active. - Add a Record: Create an A record for
app.internal.aws.trainingpointing to10.0.1.50.
Example 2: Configuring Inbound Endpoints
Goal: Allow an on-premises server at 192.168.1.100 to resolve db.internal.vpc.
- Setup: Create an Inbound Endpoint in the VPC.
- Security: Assign a Security Group allowing Inbound UDP/TCP 53 from
192.168.1.0/24. - Execution: On the on-premises server, set a conditional forwarder for
internal.vpcto point to the IP addresses provided by the Inbound Endpoint.
Checkpoint Questions
- What two VPC attributes must be set to
truefor Private Hosted Zones to function? - Can a single Private Hosted Zone be associated with VPCs in different AWS accounts?
- Which Route 53 component is required to resolve on-premises DNS names from an EC2 instance?
- Why might a DNS query to a PHZ fail even if the record exists and the VPC is associated? (Hint: Check Security Groups).
Muddy Points & Cross-Refs
- PHZ vs. DHCP Options: Users often confuse these. DHCP Options Sets tell the OS which DNS server to talk to; PHZs are the database that the Route 53 Resolver consults when it receives a query.
- Overlapping Namespaces: If you have a PHZ and a Public HZ with the same name, the PHZ takes precedence for resources inside the associated VPC.
- Further Study: See AWS Resource Access Manager (RAM) for cross-account PHZ sharing and Route 53 Resolver DNS Firewall for filtering internal queries.
Comparison Tables
| Feature | Public Hosted Zone | Private Hosted Zone |
|---|---|---|
| Visibility | Public Internet | Associated VPCs only |
| IP Address Types | Public IPs / Public Load Balancers | Private IPs / Internal Load Balancers |
| Mandatory Records | NS and SOA (automatically created) | NS and SOA (automatically created) |
| Pricing | $0.50 per month per zone | $0.50 per month per zone |
| Primary Use Case | External website hosting | Internal microservices & hybrid cloud |