Sub topic 2
Common Record Types and Choosing a TTL
This chapter assumes you understand IP addresses, ports, DNS resolvers, and basic Route 53 hosted zones. It focuses on choosing records and controlling how long resolvers cache answers.
Common record types and TTL
A DNS record maps a name to an answer. Route 53 supports these commonly used types:
| Type | Purpose | Example |
|---|---|---|
| A | Maps a name to an IPv4 address | `www.example.com → 192.0.2.10` |
| AAAA | Maps a name to an IPv6 address | `www.example.com → 2001:db8::10` |
| CNAME | Points a name to another DNS name | `www → app.example.net` |
| MX | Selects mail servers, with priorities | `10 mail.example.com` |
| TXT | Stores text for verification or email policy | SPF, DKIM, ownership checks |
| NS | Lists authoritative name servers | Hosted-zone delegation |
The time to live (TTL) is the number of seconds a resolver may cache an answer. A low TTL, such as 60 seconds, makes changes visible sooner but increases DNS queries. A high TTL, such as 86,400 seconds, reduces queries but makes old answers persist longer.
Use a lower TTL during migrations or failover tests. Raise it after the configuration is stable. TTL does not force every resolver to refresh immediately because clients and intermediate resolvers can cache independently.
Alias records and the zone apex
An alias record points to an AWS resource, such as an Application Load Balancer, CloudFront distribution, or API Gateway endpoint. Unlike a CNAME, an alias can be used at the zone apex, such as example.com. DNS does not allow a CNAME at that name because the apex must also contain the zone's NS and SOA records.
Alias records do not require a user-specified TTL. Route 53 uses the target service's behavior.
{
"Changes": [{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "example.com",
"Type": "A",
"AliasTarget": {
"HostedZoneId": "Z2FDTNDATAQYW2",
"DNSName": "d111111abcdef8.cloudfront.net",
"EvaluateTargetHealth": false
}
}
}]
}Health checks for endpoints
A Route 53 health check probes an endpoint, such as https://www.example.com/health. You can attach its ID to a routed record. Routing policies can then avoid an unhealthy endpoint.
aws route53 create-health-check \
--caller-reference "health-$(date +%s)" \
--health-check-config '{"Type":"HTTPS","FullyQualifiedDomainName":"www.example.com","Port":443,"ResourcePath":"/health","RequestInterval":30,"FailureThreshold":3}'Exercise
Which record should point example.com to a CloudFront distribution, and why is a CNAME unsuitable?
Show answer
Use an alias A record. The zone apex cannot contain a CNAME, but an alias can point there.