Route53 With Application Loadbalancer

Amazon Route 53 is a scalable and highly available Domain Name System (DNS) web service that allows you to manage and route traffic to your resources in a reliable and cost-effective way. Amazon Route 53, combined with the powerful Application Load Ba…


This content originally appeared on DEV Community and was authored by Clinton Ogechi

Amazon Route 53 is a scalable and highly available Domain Name System (DNS) web service that allows you to manage and route traffic to your resources in a reliable and cost-effective way. Amazon Route 53, combined with the powerful Application Load Balancer (ALB), provides a robust solution to distribute traffic across EC2 instances in multiple availability zones.

Step 1: Set Up the Application Load Balancer (ALB)

1. Launch Two EC2 Instances

  • Open the AWS Management Console and navigate to the EC2 dashboard.
  • Launch two EC2 instances in different availability zones (e.g., us-east-1a and us-east-1b) with the same AMI and security group.
  • Ensure that both instances have HTTP and SSH ports enabled in their security group.
  • Add this bash script file for server 1.
#!/bin/bash
yum update -y
yum upgrade -y
yum install httpd -y
systemctl start httpd
systemctl enable httpd
echo "<h1>My Webserver 1</h1>" > /var/www/html/index.html
  • Add this bash script file for server 2.
#!/bin/bash
yum update -y
yum upgrade -y
yum install httpd -y
systemctl start httpd
systemctl enable httpd
echo "<h1>My Webserver 2</h1>" > /var/www/html/index.html

Image description

Image description

Image description

2. Create a Target Group

  • Navigate to Target Groups in the EC2 dashboard.
  • Click Create target group and select the Instances type.
  • Select your VPC and include both EC2 instances in the target group.
  • Ensure health checks are enabled for your instances.

Image description

Image description

Image description

Image description

Image description

Image description

3. Create the Application Load Balancer

  • Navigate to Load Balancers in the EC2 dashboard.
  • Click Create Load Balancer and select Application Load Balancer.
  • In the Network mapping section, select your VPC and choose the availability zones where your EC2 instances are running.
  • Assign the same security group that allows HTTP traffic.
  • Under Listeners and Routing, select the target group you created earlier.
  • Click Create Load Balancer.

Image description

Image description

Image description

Image description

4. Check the Status of the Load Balancer

  • Wait until the status of your Load Balancer changes from "Provisioning" to "Active."
  • Check the target group to ensure both EC2 instances are showing as healthy.

Image description

Step 2: Use AWS Provided DNS Name

1. Get the DNS Name of the Application Load Balancer

  • After the Load Balancer is created, go to the Load Balancers section in the EC2 dashboard.
  • Select your ALB, and you’ll see the DNS name of the Load Balancer.

2. Test the Load Balancer

  • Open a web browser and paste the ALB DNS name in the address bar.
  • You should be able to see the webpage served by one of your EC2 instances.
  • Refresh the browser a few times, and the request should switch between both EC2 instances.

Image description

Image description

Step 3: Route 53 Custom Domain Integration

1. Create a Hosted Zone in Route 53

  • In the AWS Management Console, navigate to Route 53.
  • Click on Hosted Zones and create a new hosted zone.

Image description

Image description

Image description

2. Create a CNAME Record

  • Go to the hosted zone you created.
  • Click Create Record and choose CNAME as the record type.
  • In Record name - www
  • Record type - CNAME
  • Value - DNS of our application load balancer we created in above steps.
  • Click on Create records.

Image description

  • Now we need to copy the NS record type → all 4 Value/Route traffic and paste it in the name servers of our purchased domain.

Image description

  • In web browser search your domain name and the request will be served from both the instances. You can test this setup using the DNS name provided by the ALB, as you won't be able to route traffic using the placeholder domain without proper registration.

Conclusion

By successfully integrating Amazon Route 53 with an Application Load Balancer, you've implemented a highly available and fault-tolerant architecture that optimizes traffic distribution across multiple EC2 instances. This setup not only enhances application performance but also ensures that requests are dynamically routed to healthy instances in multiple availability zones.


This content originally appeared on DEV Community and was authored by Clinton Ogechi


Print Share Comment Cite Upload Translate Updates
APA

Clinton Ogechi | Sciencx (2024-09-04T20:34:55+00:00) Route53 With Application Loadbalancer. Retrieved from https://www.scien.cx/2024/09/04/route53-with-application-loadbalancer/

MLA
" » Route53 With Application Loadbalancer." Clinton Ogechi | Sciencx - Wednesday September 4, 2024, https://www.scien.cx/2024/09/04/route53-with-application-loadbalancer/
HARVARD
Clinton Ogechi | Sciencx Wednesday September 4, 2024 » Route53 With Application Loadbalancer., viewed ,<https://www.scien.cx/2024/09/04/route53-with-application-loadbalancer/>
VANCOUVER
Clinton Ogechi | Sciencx - » Route53 With Application Loadbalancer. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/04/route53-with-application-loadbalancer/
CHICAGO
" » Route53 With Application Loadbalancer." Clinton Ogechi | Sciencx - Accessed . https://www.scien.cx/2024/09/04/route53-with-application-loadbalancer/
IEEE
" » Route53 With Application Loadbalancer." Clinton Ogechi | Sciencx [Online]. Available: https://www.scien.cx/2024/09/04/route53-with-application-loadbalancer/. [Accessed: ]
rf:citation
» Route53 With Application Loadbalancer | Clinton Ogechi | Sciencx | https://www.scien.cx/2024/09/04/route53-with-application-loadbalancer/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.