Graduate Program KB

Section 6 - Route 53

DNS

  • Domain Name System to translate hostnames into IP addresses
  • Uses a hierarchical naming structure
  • Terminologies:
    • Domain Registrar: Route 53, GoDaddy, etc.
    • DNS Records: A, AAAA, CNAME, NS, etc.
    • Zone File: Contains DNS records
    • Name Server: Resolves DNS queries (Authoritative or Non-Authoritative)
    • Top Level Domain: .com, .us, .in, .gov, .org, etc.
    • Second Level Domain: amazon.com, google.com, etc.

Route 53

  • Serverless, highly availability and scalable Authoritative DNS (you can update the DNS records)
  • Check resource health
  • The only AWS service which provides 100% availability SLA
  • Records define how traffic is routed for a domain
    • Domain/subdomain name
    • Record type
    • Value: IP address
    • Routing policy
    • TTL
    • Supports the following record types: A, AAAA, CNAME, NS
      • Advanced: CAA, DS, MX, NAPTR, PTR, SOA, TXT, SPF, SRV

Record Types

  • A maps a hostname to IPv4
  • AAAA maps a hostname to IPv6
  • CNAME maps a hostname to another hostname
    • The target domain name must have an A or AAAA record
  • NS are name servers for the hosted zone, controlling how traffic is routed for a domain

Host Zones

  • A container for records defining how traffic is routed to a domain and its subdomains
  • Public: Specify how to route traffic on the internet
  • Private: Specify how to route traffic within one or more VPCs
  • Pay $0.50 per month per hosted zone

Records TTL

  • High TTL (ex. 24 hr): Less traffic on Route 53 and possibly outdated records
  • Low TTL (ex. 60 sec.): More traffic on Route 53, records are outdated for less time and easy to change
  • Mandatory for each DNS record except for Alias records
  • CNAME vs. Alias
    • CNAME: Points a hostname to any other hostname, only for non-root domain
    • Alias: Points a hostname to an AWS resource
      • Works for root and non-root domains
      • Free of charge with native health check

Alias Records

  • Map hostname to AWS resource
    • ELB, CloudFront distributions, API gateway, Beanstalk environments, S3 websites, VPC interface endpoints, Global Accelerator accelerator, Route 53 record in same hosted zone
    • Can't set for an EC2 DNS name
  • Extension to DNS functionality, automatically recognizing changes in the resource's IP address
  • Can be used for the top node of a DNS namespace unlike CNAME
  • Always of type A or AAAA for AWS resources
  • Can't set TTL

Routing Policies

  • Defines how Route 53 responds to DNS queries
  • Routing policies:
    • Simple:
      • Route traffic to single resource
      • Specify multiple values in same record, client randomly chooses a value if multiple are returned
      • No associated health checks
    • Weighted:
      • Control percentage of requests that go to each specific resource
      • DNS records must have same name and type
      • Associated health checks
      • Useful for load balancing between regions and testing new app versions
    • Latency-based:
      • Redirect to resource with lowest latency to the user
    • Failover
    • Geolocation:
      • Routing based on user location
      • Associated health checks
    • Multi-Value:
      • Routing traffic to multiple resources, Route 53 will return multiple values/resources
      • Associated health checks, returning only values for healthy resources
      • Up to 8 healthy records returned for each Multi-Value query
    • Geoproximity:
      • Route traffic based on geographic location of users and resources
      • Shift more traffic to resources based on defined bias
      • Must use Route 53 Traffic Flow to use this feature
    • IP-based:
      • Routing based on clients' IP addresses
      • Provide a list of CIDRs for clients and the corresponding endpoints/locations
      • Useful for optimizing performance and reducing network costs

Health Checks

  • HTTP health checks only for public resources
  • Integrated with CloudWatch metrics
  • Monitoring an endpoint
    • Approx. 15 global health checkers check endpoint health, if > 18% of health checkers report the endpoint is healthy then Route 53 considers it healthy
    • Pass only when endpoint responds with 2XX or 3XX status codes
    • Can be setup to pass / fail based on text in the first 5120 bytes of the response
    • Configure router/firewall to allow incoming requests from health checkers
  • Calculated health checks
    • Combine results of multiple health checks into a single check using OR, AND or NOT
    • Monitor up to 256 child health checks
  • Private hosted zones
    • Health checkers are outside the VPC, they can't access private endpoints
    • Can create a CloudWatch metric and associate an alarm, then create a health check that checks the alarm itself

Domain Registrar vs. DNS Service

  • Buy or register domain name with a Domain Registrar by paying annual charges
  • The Registrar usually provides you with a DNS service to manage DNS records
  • For 3rd party registrar:
    • Create hosted zone in Route 53
    • Update NS Records on 3rd party website to use Route 53 Name Servers