🌐

Understanding Domain Name System (DNS)

Mar 17, 2025

Lecture Notes on Domain Name System (DNS) and Related Topics

Introduction to DNS

  • DNS as an Intermediary: Translates IP addresses into human-readable host names or domain names.
  • Database Nature of DNS: DNS is a distributed and resilient database.
    • Distribution: DNS information is stored across different name servers.
    • Resilience: Globally available, exemplified by services like AWS Route 53.

AWS Route 53

  • Services Offered:
    • Domain registration and hosting.
    • Ability to register a new domain or import an existing one.
  • Hosted Zones:
    • Public Hosted Zones: Routes internet traffic globally.
    • Private Hosted Zones: Routes traffic within a specific VPC, used for internal company domains.

DNS Record Types

  • Records as Instructions: They provide information on how traffic should be routed.
  • Types of Records:
    • Name Server (NS) Records: Identify name servers in a hosted zone.
    • A and AAAA Records: Map hostnames to IP addresses (A for IPv4, AAAA for IPv6).
    • Canonical Name (CNAME) Records: Create shortcuts to route traffic to another domain.
    • TXT Records: Verify domain ownership, not typically used for routing traffic.

Time to Live (TTL)

  • Purpose: Specifies how long DNS records should be cached by resolvers.
  • High TTL: Used when data changes infrequently.
  • Low TTL: Suitable for frequently changing data or during migrations.

DNS Routing Policies

  • Simple Routing Policy: Directs traffic to a single resource, does not support health checks.
  • Failover Routing Policy: Routes traffic to a primary resource and fails over to a secondary if the primary is unhealthy, supports health checks.
  • Weighted Routing Policy: Distributes traffic based on set weights, useful for testing new versions of applications.
  • Latency-based Routing: Routes traffic to the endpoint that offers the lowest latency.
  • Geolocation Routing: Routes based on the geographical location of the user.
  • Geoproximity Routing: Focuses on routing based on physical distance to the endpoint.

Hands-On Simulation

  • Setup Overview:
    • Create EC2 instances, VPCs, and security groups.
    • Configure a load balancer and Route 53 records.
    • Integrate CloudFront for content delivery and caching.
  • Key Steps:
    • Create a public certificate with AWS Certificate Manager (ACM) for secure connections.
    • Setup a CloudFront distribution with alternate domain names.
    • Use Route 53 to create simple and failover routing policies.
    • Simulate failover by stopping the primary instance and observing traffic routing to the secondary instance.

Key Takeaways

  • The importance of understanding the DNS ecosystem and how different components like Route 53, load balancers, and CloudFront interact.
  • The need for secure and efficient domain management using tools like AWS.
  • Practical skills in setting up DNS configurations, routing policies, and understanding their implications in real-world applications.