Amazon Route 53 Routing Options
Simple Routing
- Registered domain: mompopcafe.net, managed with Amazon Route 53.
- VPC with two Amazon EC2 instances.
- Each instance runs a web server hosting the mom pop cafe website.
- Instances are configured identically.
- Goal: Distribute HTTP requests evenly between the two EC2 instances in a round-robin fashion.
Configuration Steps
- Define a Route 53 record set in the mompopcafe.net hosted zone.
- Create public subnets in different availability zones.
- Run EC2 instances in different availability zones.
- Copy the public IP address of each instance.
- Configure the Route 53 record set with the IP addresses.
AWS Management Console Configuration
VPC: Public subnets one and two exist in different availability zones.
EC2: Two instances of the mom pop cafe server are running, each in a different subnet and availability zone.
Verification: Web app is running on both servers.
- EU West 2A
Objective: Route traffic evenly between the two instances using the domain name.
Route 53 Service Dashboard
- One registered domain and one hosted zone.
- Domain mompopcafe.net is registered with Route 53.
- Hosted zone created with the domain name.
- Existing record sets: NS (name server) and SOA (start of authority).
Creating a New Record Set
- Click "Create Record Set".
- Name: www.mompopcafe.net.
- Type: A record (maps DNS name to one or more IP addresses).
- TTL (Time To Live): 15 seconds (short for demo purposes).
- Value: Paste the public IP addresses of the two running servers.
- Routing Policy: Simple (default).
- Save the record set.
Testing the Configuration
- Open a new browser tab and load the URL www.mompopcafe.net/mompopcafe.
- Verify that one of the two instances' page loads.
- Load the page multiple times to see traffic being routed between the two instances.
Explanation
- Route 53 returns the two IP address values in random order to the recursive resolver.
- The resolver returns the values to the web browser that submitted the DNS query.
- HTTP requests to the domain name are routed between the two specified instances.
Failover Routing
- Registered domain: mompopcafe.net managed with Amazon Route 53.
- VPC with two subnets in different availability zones.
- Each subnet has an EC2 instance running a web server hosting the mom and pop cafe website.
- Instances are configured identically.
- Goal: One instance (in availability Zone one) is the primary server. If it goes down, the instance in availability Zone two takes over.
Configuration
- Define a Route 53 health check that monitors the status of the primary web server instance.
- If the health check determines the primary instance is unreachable, traffic is routed to the secondary instance.
- The Route 53 health check sends an alert to the administrator team.
AWS Management Console Setup
- VPC: Public subnets one and two already exist.
- EC2: Two instances of the mom pop cafe server are running in different subnets and availability zones.
- Verification: Primary web server is working.
Route 53 Service Dashboard
- One registered domain and one hosted zone.
Health Check Configuration
Go to health checks and click create health check.
Name: London website status.
Monitor: Endpoint by IP address.
Paste the public IP of the primary web server running in EUS two a.
Port number: 80.
Path: /mompopcafe (the URL that loads the web application).
Advanced Configuration:
- Request interval: 10 seconds (short for demo).
- Failure threshold: 2 (number of health checks that need to fail).
Create alarm: Define an SNS topic website down and enter email address.
Click create health check.
Configuring Failover Routing
- Go to hosted zones and click on the registered domain.
- Click create record set.
- TTL: 15 seconds.
- Value: Public IP address from the primary server.
- Routing policy: Failover.
- Failover record type: Primary.
- Is this associated with a health check? Yes.
- Choose the health check defined earlier.
- Click create to save the record set.
- Define another record for the secondary web server.
- Give it the same name and 15 seconds for the TTL.
- For the value, copy the public IP of the web server.
- Routing policy: Failover, but this time the failover record type is secondary.
- The record set does not need a health check associated with it.
- Click Create.
Testing the Configuration
- Load the URL in a browser tab.
- The primary web server (EU West 2 A) should load.
- Simulate an issue with the web server by stopping the primary instance.
- Check the status of the Route 53 Health check.
- Verify that the health check status changes to unhealthy.
- Load the page again, and the secondary server should load.
Result
- The website was only unresponsive for a few seconds.
- Failover routing kicked in after 20 seconds (10-second interval * 2 failures).
- HTTP requests are now routed to the secondary instance.
Final Step
- Check email for the notification sent by the simple notification service.
- Verify that the email informs about the web server failing the health check.
Geolocation Routing
- Goal: Route users to specific resources based on their geographic location.
- Users in Europe are routed to the website instance in the EU West 2 London region.
- Users in North America are routed to the website instance in The US East 1 Virginia region.
- Content localization: Currency in British pounds on the London website and in US dollars on the Virginia site.
AWS Management Console Configuration
- EC2 management console in the London Data Center: Instance of the mom pop cafe server running.
- Verification: Web server is working.
- EC2 management console in the Virginia region: Instance of the mom pop cafe server running.
- Verification: Web server is working.
- Route 53 service dashboard: One registered domain and one hosted zone.
Creating New Record Sets
- Click create record set.
- Name: www.
- Type: A record.
- TTL: 15 seconds.
- Value: London web server's public IP address.
- Routing policy: Geo location.
- Location: Europe.
- Set ID: Europe London.
- Create the record set.
- Create another record set.
- Value: Virginia web server's public IP address.
- Routing policy: Geolocation.
- Location: North America.
- Set ID: North America-Virginia.
- Click Create.
Testing the Configuration
- Emulate different geographic locations using Windows instances.
- One instance in California and one in Paris.
- Establish a remote desktop connection to the California instance.
- Open a web browser and pull up the mompopcafe.net site.
- Verify that you are routed to the Virginia instance.
- Check the menu page to confirm the currency is in US dollars.
- Establish a remote desktop connection to the Paris, France instance.
- Open a web browser and pull up the mompopcafe.net site from there.
- Verify that you are routed to the London instance.
- Check the menu page to confirm the currency is in British pounds.