Thursday 1 October 2020

Application load balancer

with  Application load balancer can do the following:

  • Load balancing to multiple HTTP applications across machines (target groups)
  • Load balancing to multiple applications on the same machine(ex: containers)
  • Load balancer based on route in URL.
  • Load balancer based on hostname in URL.
in comparison, we would need to create one Classic load balancer per application before. That was very expensive and inefficient.



Target group represent one application included with some EC2 instances along with health check. we will register the target group to Application load balancer.

in the below flowchart, we have 2 target group with representation of 2 application, registered to application load balancer with the protocol HTTP.


if the user searches for route/user, then the application load balancer redirected it to target group users. Similarly for search target group also,if the user search for route/search, our Application load balancer will re-direct it to search target group.




in this post, we will do hands on for:

  • Create a target group.
  • Setup an application load balancer.
practical steps for Create a target group :

---------------------------------------------------------------------------------------------------------------------------
from load balancer page --> Navigate to load balancer --> target groups(as shown below).




Click on Create target group.


Provide details:
1. enter target group name:                                                                           
2.enterprotocol for EC2 instance connection from target group.         
3.port no. for HTTP protocol is 4567.                                         
4.VPC: i'm give default one.                                                

Health check settings:                                                                                           
protocol as HTTP                                                                            
path = /health                                                                                  

Click on the Advanced health check settings dropdown.                                                                              provide the override port (ex: port no.4568) if required.                                                    
provide time interval info.                                                                                                 
finally click on create. 

conformation screen for target group creation.                                                                                                  





Then screen will prompts to target group page, Navigate to Targets tab --> Edit.

Then the screen goes to Register and deregister targets page. 
1.Ensure that the port number is 4567 based on protocol.                                          
2.select the required EC2 instance that need to add target group.                              
                 3.click on Add to registered.                                                                                                      4.Finally click on SAVE option available at the right bottom of the page.               
                                    


Now both the EC2 instances are available now in the targets group tab. but the status of EC2 instance will be unused until load balancer assigned to target group.



-----------------------------------------------------------------------------------------------------------------------------

  • practical steps for Setup an application load balancer:


Now navigate to load balancer page:


Click on create load balancer.



Choose application load balancer--> Click on Create.


provide details for the load balancer:

Name : <load balancer name>
scheme: internet facing - public ip based load balancer( web)
by default load balancer HTTP protocol and load balancer port as 80 is available.



here i am selecting all the availability zones and click on Next.


can add other protocol waring screen will appears in the next step. can ignore and click on next.
if any other protocol is required add them in the last step & Now click on Next.




Add security Groups to the load balancer.


Configure routing: 

choose Target group as Existing target group.
Name : dropdown select the correct load balancer.

rest all information will be updated based on this 2 entries.

Click on Next.



Conform the target groups and click on Next.


Review all the inputs and click on create.




Now change security groups, so that application load balancer will access the EC2 instances.







That's all similarly we can add multiple target groups to single Application load balancer.



-----------------------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment