How to Create Application load balancer on Amazon Web Service(AWS).
A load balancer serves as the single point of contact for clients. The load balancer distributes incoming application traffic across multiple targets, such as EC2 instances, in multiple Availability Zones. This increases the availability of your application. You add one or more listeners to your load balancer.
Elastic Load Balancing supports the following types of load balancers: Application Load Balancers, Network Load Balancers, and Classic Load Balancers. Amazon ECS services can use either type of load balancer. Application Load Balancers are used to route HTTP/HTTPS (or Layer 7) traffic.
- Login to aws portal.
- Click on Services.
- Under Compute select EC2.
- Click on load balancers.
- Click on Create Load Balancer.
- Four types of load balancer :application, network, classic and gateway load balancer.
- Select Application load balancer.
- Click on Create.
- Provide load balancer name.
- Select Scheme like internet-facing or internal.
- An Internet-facing load balancer routes requests from clients over the Internet to targets.
- An internal load balancer routes requests from clients to targets using private IP addresses.
- Provide IP address type. The IP addresses used by subnets either IPv4 (ipv4) or IPv6 (dualstack).
- Select Listeners like HTTP or HTTPs.
- Select default or existing VPC & availability zone.
- Click on Tags.
- Provide key name & value for application load balancer.
- Then click on Next Configure Security settings.
- Click on Next configure security groups.
- Create or select existing security group.
- We can add multiple rules as per requirements.
- Click on Next configure Routing.
- Create or select existing target group name so click on link https://www.hackerxone.com/blog/how-create-target-groups-load-balancer-amazon-web-serviceaws for how to create Target group.
- Click on Next Register Targets.
- Select Both running instance.
- Click on Add to registered on port number 80.
- Both instance is ready for load balancer.
- Click on Next Review.
- Review all load balancer configuration.
- Then click on Create
- Load balancer created successfully.
- Click on close then go to load balancer console page.
- After sometime load balancer will be ready (provisioning state to active statue).
- Then copy the DNS of load balancer & paste on browser tab, If everything is working then browser will displays web page of servers.
Create Load balancer using Shell
- Setup aws-cli on your system so click on link https://www.hackerxone.com/blog/how-install-configure-aws-cli-ubuntu-1804
- Run the following command:
- To create an Internet-facing load balancer.
aws elbv2 create-load-balancer –name load-balancer-name –subnets subnet-id subnet-id
2.To create an internal load balancer.
aws elbv2 create-load-balancer –name internal-load-balancer-name –scheme internal –subnets subnet-id subnet-id