Tech Junkie Blog - Real World Tutorials, Happy Coding!: Iaas With AWS: Create An Application Load Balancer (Host)

Wednesday, October 13, 2021

Iaas With AWS: Create An Application Load Balancer (Host)

 In the previous post we went over how to create a Application Load Balancer, based on routes in the URL.  In this post we are going to change the rules so that it directs traffic based on host names.  For example we could have acmebanking.com route to target group 1 and accounts.acmebanking.com route to target group 2.  It's the same concept as the previous setup but instead of routes, we are using hostnames instead.

In order to implement this solution we need to setup a record in Route 53, which is AWS domain registration service.  You can follow along with the DNS names, but if you have a hostname registered with AWS that's even better.

1. So the first thing you want to do is go to Route 53 dashboard, go to Hosted Zones

2. Click on the hosted domain



3. Click on "Create Record" button, to create an A record

An A record is basically an alias record that points to the underlying IP address, for example an A record of acmebanking.com points to some IP address.  If a browser sends a request to acmebanking.com, it is directed to the server with a particular IP address.

4. Select "Simple Routing", then click "Next"


5.  Select "Define simple record"




6.  We want to create two A records, one is the root domain record acmebanking.com and the other A record will be accounts.acmebanking.com.  First lets create the root record, leave the "Record name"  field blank so that the alias is just acmebanking.com.  Then route the traffic to the Application Load Balancer we created in the previous post. Then click on "Define simple record"


You should see the following if you are following along



7. Create another A record, but this time type accounts in the "Record name" field so the alias will be accounts.acmebanking.com, then click on the "Define simple record" button. 

You should see the following A records, select both records and click on "Create records"


Now these records are created, which points to the load balancer.


8.  Now you want to add a rule to the load balancer to direct traffic to target group 2 if the hostname is accounts.acmebanking.com.  So go to the load balancer and click on the "View/edit rules"

9. Click on the + sign next to "Rules", click "+ Insert Rule", "+ Add condition", "Host header"



11.  The rule should look like the following, it basically says if the hostname is accounts.acmebanking.com direct traffic to target group 2, else direct traffic to target group 1 if it's the root hostname. Click "Save"


12. Final rules should look like the following


Now if you type acmebanking.com you should get a different instance from accounts.acmebanking.com because they target different target groups.




13 comments:

  1. blogger templates Blogger Templates 2021 daily updates with newly designed free blogger templates. Blog templates with Highly SEO optimized, Responsive Layout professional blogger templates free latest Blogger template free download 2021 Free Blogger Templates. Are you looking for Free Blogger Templates for making a highly professional website

    ReplyDelete
  2. Very interesting post. Thanks for sharing such a great post. Butterfly Lyrics

    ReplyDelete
  3. Great article, This is really helpful for a newbie like me.
    custom logo design company

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Great Amazing article you have here. I am glad I found it. I will bookmark you. By the way

    There are so many article rewriters but this is The best article rewriter tool

    ReplyDelete

  6. Very nice and interesting article. Thanks for sharing information. Also check my website Best Poetry Wala

    ReplyDelete

  7. Thanks for sharing this article. You have a lot of information about that and uh can also visit
    Massage center in Lahore for your wellness and mind relax spa.

    ReplyDelete
  8. Mind blowing article you have good writing skill. Thanks for sharing this article And also visit Paint protection flim.
    ECM online shop

    ReplyDelete

Search This Blog