Elastic Load Balancing
Elastic Load Balancing service allows you to distribute traffic across a group of Amazon EC2 instances enabling you to achieve high availability in your applications.
Elastic Load Balancing supports routing and load balancing of Hypertext Transfer Protocol(HTTP), Hypertext Transfer Protocol Secure (HTTPS), Transmission Control Protocol (TCP), and Secure Sockets Layer(SSL)traffic to Amazon EC2 instances.
Elastic Load Balancing supports health checks for Amazon EC2 instances to ensure traffic is not routed to unhealthy or failing instances.
We will not get any public IP address for ELBs, We will get a DNS record for every LB
Advantages of ELB
Elastic Load Balancing is a managed service,it scales in and out automatically to meet the demands of increased application traffic and is highly available with in a region itself as a service.
ELB helps you achieve high availability for your applications by distributing traffic across healthy instances in multiple Availability Zones.
ELB seamlessly integrates with the Auto Scaling service to automatically scale the Amazon EC2 instances behind the load balancer.
ELB is secure,working with Amazon Virtual Private Cloud(Amazon VPC)to route traffic internally between application tiers,allowing you to expose only Internet-facing public IP addresses.
ELB also supports integrated certificate management and SSL termination
We have three types of load balancers available with AWS.
- Classic Lead balancer
- Application load Balancer
- Network Load Balancer
A Network Load Balancer functions at the fourth layer of the Open Systems Interconnection(OSI) model.It can handle millions of requests per second. After the load balancer receives a connection request,it selects a target from the target group for the default rule.It attempts to open a TCP connection to the selected target on the port specified in the listener configuration
An Application Load Balancer functions at the application layer,the seventh layer of the Open Systems Interconnection(OSI) model.After the load balancer receives a request,it evaluates the listener rules in priority order to determine which rule to apply,and then selects a target from the target group for the rule action using the round robin routing algorithm. Note that you can configure listener rules to route requests to different target groups based on the content of the application traffic.Routing is performed independently for each target group,even when a target is registered with multiple target groups.
We can add and remove targets from load balancer a sour needs change,with out disrupting the overall flow of requests to our application.
A Classic load balancer work with listener checks for connection requests from clients,using the protocol and port that we configure,and forwards requests to one or more registered instances using the protocol and port number that you configure.We can add one or more listeners to our load balancer.
Internet-Facing Load Balancers: An Internet-facing load balancer is a load balancer that takes requests from clients over the Internet and distributes them to Amazon EC2 instances that are registered with the load balancer.
Internal load balancers: Internal Load Balancers that connect and route traffic to private subnets. We can use internal load balancers to route traffic to your Amazon EC2 instances in VPCs with private subnets
Listeners: Every load balancer must have one or more listeners configured.A listener is a process that checks for connection requests.
Health Checks:Elastic Load Balancing supports health checks to test the status of the Amazon EC2 instances behind an Elastic Load Balancing load balancer
The status of the instances that are healthy at the time of the health check is InService.The status of any instances that are unhealthy at the time of the health check is Out Of Service.
The load balancer performs health checks on all registered instances to determine whether the instance is in a healthy state or an unhealthy state.
A health check is a ping,a connection attempt,or a page that is checked periodically.You can set the time interval between health checks and also the amount of time to wait to respond in case the health check page includes a computational aspect.
We can set a Threshold for the number of consecutive health check failures before an instance is marked as unhealthy.
To create ELB navigate to EC2 Management Console. Next, from the navigation pane, select the Load Balancers option,this will bring up the ELB Dashboard as well,using which you can create and associate ELBs.
Step 1 – Defining the Load Balancer
- Select Create Load Balancer option and provide a suitable name for ELB in the Load Balancer name field.Next select the VPC option in which you wish to deploy ELB.
- Do not check the Create an internal load balancer option as in this scenario,we are creating an Internet-facing ELB for Web Server.
- In the Listener Configuration section,select HTTP from the Load Balancer Protocol drop- down list and provide the port number 80 in the Load Balancer Port field,as shown in the following screenshot.Provide the same protocol and port number for the Instance Protocol and Instance Port fields.
4. Here,We have to select the Security group for ELB
5 .In Step 3 we have to configure security settings,This is an optional page that basically allows you to secure your ELB by using either the HTTPS or the SSL protocol for your But since we have opted for a simple HTTP-based ELB,we can ignore this page.Click on Next: Configure Health Check to proceed to the next step.
6.In step 4 we have to configure the health checks
Ping protocol:This field indicates which protocol the ELB should use to connect to EC2 instances. We can use the TCP, HTTP, HTTPS, or the SSL options.
Ping port: This field is used to indicate the port which the ELB should use to connect to the instance.
Ping path:This value is used for the HTTP and HTTPS protocols.Can also use a/index.html here.
Response time:The Response Time is the time the ELB has to wait in order to receive a response. The default value is 5seconds with a maximum value upto 60 seconds.
Health Check Interval:This field indicates the amount of time(in seconds)the ELB waits between health checks of an individual EC2 instance.The default value is 30.Maximum value is 300 seconds.
Unhealthy Threshold:This field indicates the number of consecutive failed health checks an ELB must wait before declaring an instance unhealthy.The default value is 2 with a maximum threshold value of 10.
Healthy Threshold:This field indicates the number of consecutive successful health checks an ELB must wait before declaring an instance healthy.The default value is 2 with a maximum threshold value of 10.
Step 7–Add EC2 instances:We can select any running instance from Subnets to be added and registered with the ELB. Select the EC2 instances you want to launch under this ELS then Click on Next:Add Tags to proceed with the wizard.
8. In next step,Add any of the tags required and Review the option and click on Create option
9. I have a installed http package and created an Index.html file under/var/www/html path in ec2 instance then started the httpd service an dam able to get the web page using the Instance’s public IP
10. And Here is the details for created ELB,As we know we’ll get a DNS name for our created ELB,We can access the same webpage by using the ELB’s DNS name also
11. We are able to get the same page by using the DNS name of ELB. This means our ELB configured successfully.
More Information :https://www.fgrade.com/amazon-web-services/