Route 53 with ELB integration in AWS - Time & Space Complexity
When connecting Route 53 to an Elastic Load Balancer (ELB), it is important to understand how the number of DNS records and ELB endpoints affect the time it takes to process requests.
We want to know how the work grows as we add more DNS records or ELB endpoints.
Analyze the time complexity of the following operation sequence.
// Create ELB
aws elb create-load-balancer --load-balancer-name myELB --listeners Protocol=HTTP,LoadBalancerPort=80,InstanceProtocol=HTTP,InstancePort=80 --availability-zones us-east-1a
// Create Route 53 record pointing to ELB
aws route53 change-resource-record-sets --hosted-zone-id ZONEID --change-batch '{"Changes":[{"Action":"CREATE","ResourceRecordSet":{"Name":"example.com.","Type":"A","AliasTarget":{"HostedZoneId":"ELBZONEID","DNSName":"myELB-123456.us-east-1.elb.amazonaws.com.","EvaluateTargetHealth":false}}}]}'
// Repeat for multiple records
This sequence creates an ELB and then creates Route 53 DNS records that point to the ELB using alias records.
Identify the API calls, resource provisioning, data transfers that repeat.
- Primary operation: Creating Route 53 DNS records that alias to the ELB.
- How many times: Once per DNS record created.
Each new DNS record requires a separate API call to Route 53 to create or update the record pointing to the ELB.
| Input Size (n) | Approx. API Calls/Operations |
|---|---|
| 10 | 10 Route 53 record changes |
| 100 | 100 Route 53 record changes |
| 1000 | 1000 Route 53 record changes |
Pattern observation: The number of API calls grows directly with the number of DNS records added.
Time Complexity: O(n)
This means the time to create DNS records grows linearly with the number of records you add.
[X] Wrong: "Adding more DNS records pointing to the same ELB does not increase the number of API calls or time needed."
[OK] Correct: Each DNS record requires its own API call to Route 53, so more records mean more calls and more time.
Understanding how the number of DNS records affects API calls helps you design scalable and efficient cloud infrastructure. This skill shows you can think about how systems grow and perform in real life.
"What if we used a single wildcard DNS record instead of multiple individual records? How would the time complexity change?"
Practice
Solution
Step 1: Understand Route 53 alias records
Alias records let you point your domain name to AWS resources like ELB without needing an IP address.Step 2: Recognize ELB integration benefit
This simplifies DNS management and handles ELB IP changes automatically.Final Answer:
It allows you to point your domain directly to the ELB without using an IP address. -> Option AQuick Check:
Alias record points domain to ELB without IP [OK]
- Thinking alias records create backups
- Confusing alias with encryption
- Assuming alias reduces ELB cost
Solution
Step 1: Know Route 53 record types for ELB
ELB does not have fixed IPs, so you cannot use IP addresses directly.Step 2: Use alias A record
Route 53 allows creating an A record with alias enabled, selecting the ELB DNS name as target.Final Answer:
Create an A record and select 'Alias' with the ELB as the target. -> Option CQuick Check:
Alias A record points to ELB DNS [OK]
- Using IP address for ELB
- Choosing CNAME instead of alias A record
- Using TXT record incorrectly
Solution
Step 1: Understand Route 53 health checks with ELB
Route 53 alias records pointing to ELB do not automatically stop sending traffic if the ELB is unhealthy because ELB manages its own health and traffic routing internally.Step 2: Behavior on ELB failure
Route 53 continues to resolve the alias record to the ELB DNS name regardless of ELB health status; ELB itself stops routing traffic to unhealthy targets.Final Answer:
Route 53 continues sending traffic to the ELB regardless of health status. -> Option AQuick Check:
Route 53 alias records do not perform health-based routing for ELB [OK]
- Thinking Route 53 stops traffic to unhealthy ELB
- Assuming Route 53 deletes records on failure
- Believing Route 53 redirects to IP automatically
Solution
Step 1: Check ELB target health
If ELB has no healthy targets, it cannot serve traffic, causing website unreachable.Step 2: Verify alias record and region
Alias records can point across regions; CNAME is invalid for alias; trailing dot is not required for alias.Final Answer:
The ELB does not have any registered healthy targets. -> Option DQuick Check:
Healthy targets needed for ELB to serve traffic [OK]
- Confusing alias record type
- Assuming region mismatch breaks alias
- Thinking trailing dot is required
Solution
Step 1: Use alias A records with health checks
Route 53 supports multiple alias records with health checks to route traffic only to healthy ELBs.Step 2: Load balancing across regions
By creating two alias records with health checks, Route 53 can balance traffic and failover automatically.Final Answer:
Create two alias A records with the same domain name, each pointing to one ELB, and enable health checks on both records. -> Option BQuick Check:
Multiple alias records + health checks = HA and load balancing [OK]
- Using CNAME for ELB alias
- Manual failover instead of health checks
- Using different domain names for ELBs
Ready to prove it?
Pass the test and this pattern moves unknown
