Apart from the multi-AZ infrastructure, we also need a way to intelligently route user traffic according to the system health. This means by configuring Route 53 DNS with health check ability to route traffic to our application via ALB and automatically failover once the ALB becomes unhealthy. This way, we can protect the user from seeing downtime during outages by routing them to a backup error page.
Step 1: Setup a Hosted Zone
A hosted zone represents our domain in Route 53 and lets us manage DNS records programmatically and securely.
- Visit to Route 53, click Hosted Zones, click Create hosted zone
- Enter our domain name: (e.g., flashsalehub.com)
- Type: Public hosted zone
- Click Create hosted zone

Step 2: Setup a Health Check
Health checks allow Route 53 to detect when our application is down and automatically fail over to a backup record.
- Visit to Route 53, click Health Checks, click Create Health Check
- Configuration:
- Name:
flashsale-app-alb-health - What to monitor: Endpoint
- Name:
- Specify endpoint:
- Protocol: HTTP
- Domain name: Use our ALB DNS name (e.g.,
flashsale-app-alb-1434623095.us-east-1.elb.amazonaws.com)
- Advance Configuration:
- Request interval:
30 seconds - Failure threshold:
3
- Request interval:
- Click Create health check

Step 3: Setup Primary DNS Record (with Health Check)
This DNS record routes users to our live app hosted on EC2 behind the ALB only if it’s healthy.
- In our Hosted Zone, click Create record
- Record type: A – IPv4 address
- Alias: Enabled
- Alias to Application Load Balancer
- Region: Select the correct region (e.g.,
us-east-1) - Alias target: Select
flashsale-app-alb - Routing policy: Failover
- Failover record type: Primary
- Associate the health check created in Step 2
- Record ID – failover-primary-record
- Enable – Evaluate health targets
- Click Create records

Based on the configuration above, the traffic will only be forwarded to the ALB if it’s passing the health check.