Create an Elastic Load Balancer (ELB)
Elastic Load Balancing automatically distributes and balances the incoming application traffic among all the instances you are running, thus improving the availability and scalability of your application. It seamlessly provides load balancing capacity. You create a load balancer and register instances with it which serves as a single point of contact for clients. Addition and deletion of EC2 instances from the load balancer can be done without disturbing the flow of information.
If the call completes successfully, a new load balancer is created with a unique Domain Name Service (DNS) name. The load balancer receives incoming traffic and routes it to the registered instances. You can create up to 20 load balancers per region per account. You can request an increase for the number of load balancers for your account.
The service also makes it easy to add new instances or remove under-used instances when you need to increase or decrease the capacity of your application. The following diagram shows how the load balancer works. In this diagram, the load balancer contains two listeners. By default, the load balancer is configured to listen HTTP traffic on port 80. The first listener accepts traffic on port 80 using HTTP and forwards these requests to the Amazon EC2 instances using HTTP on port 8080. The other listener accepts traffic on the port 443 using HTTPS and forwards these requests to the Amazon EC2 instances using HTTPS on port 4443.
You can specify the protocol and port for both the client and the Amazon EC2 instances. In this step, we will create a load balancer for an HTTP service. We’ll specify that the load balancer listen on port 80 for incoming traffic from clients and then distribute traffic on port 80 to the instances.
As soon as your load balancer becomes available, you’re billed for each hour or partial hour that you keep the load balancer running. For more information about Elastic Load Balancing pricing, see the Elastic Load Balancing details page. For more information about elastic load balancers, go to the Elastic Load Balancing Documentation.
Creating a load balancer
You can create an internal load balancer to distribute traffic to your EC2 instances in private subnets.
Load Balancer has two components: the load balancer and the controller service. The load balancer monitors traffic, whereas the controller service monitors load balancers.
If a call is finished, a new load balancer is created with a unique Domain Name Service (DNS). Almost 20 load balancer can be created per account which is also extendable.
1. Define a load balancer:
Note: After you configure the listener information, you cannot change it. If you want to update this information, you will need to create a new load balancer.
2. Configure the health check:
Elastic Load Balancing routinely checks the health of each load-balanced Amazon EC2 instance. This health check determines the instances of health status. If Elastic Load Balancing finds an unhealthy instance, it stops sending traffic to the instance and reroutes traffic to healthy instances.
a) On the Configure Health Check page of the Create a New Load Balancer wizard, do the following:
On the Configure Health Check page, under Configuration Options, do the following:
Note: If you specify a ping port value, your Amazon EC2 instances must accept incoming traffic on the port that you specify. You can set a port value other than 80, and you can change this value at any time.
Elastic Load Balancing sends health check queries to the ping path you specify. This example uses a single forward slash so that Elastic Load Balancing sends the query to your HTTP server’s default home page, whether that default page is named index.html, default.html, or any other different name. When you deploy your application, consider creating a special light-weight file that responds only to the health check. Doing so helps differentiate between traffic that is hitting your site and responses to the load balancer.
Related page: How To Launch Amazon EC2 Instances Using Auto Scaling
b) On the Configure Health Check page, under Advanced Options, set the Healthy Threshold to 2. Accept the default values on the other options.
Typically, the default value of 10 is fine for a healthy threshold. To expedite this tutorial, we specify 2, so you don’t have to wait as long to see healthy instances.
c) Click Continue.
3. Add Amazon EC2 instances:
Note: After you create a load balancer, you can modify any of the settings except for Load Balancer Name and Port Configuration. To rename a load balancer or to change its port configuration, create a replacement load balancer.
The confirmation window closes, returning you to the Load Balancers page. Your new load balancer now appears in the list.
As a best practice, you should have sufficient instances across Availability Zones to survive the loss of any one Availability Zone. Therefore, we will ensure that our load balancer points to multiple Availability Zones in the next step.
Related Page: Clean Up Process In AWS
4. Record the public DNS address:
5. Add an Availability Zone:
Click us-east-1b: 0 instances.
Click us-east-1c: 0 instances.
In a later task, you will launch instances in these two Availability Zones by using Auto Scaling. You’ll see that the Availability Zones column for the load balancer is updated for both Availability Zones.
Related Page: Creating A Custom AMI In AWS
Advantages of using Load Balancing:
Elastic Load Balancing automatically distributes incoming application traffic across multiple Amazon EC2 instances in THE CLOUD. It enables you to achieve greater levels of fault tolerance in your applications, seamlessly providing the required amount of load balancing capacity needed to distribute application traffic. Its most important benefits are availabile, secure and elastic.
When You’re At
Here’s where you are while building your architecture.
In the process of Launch an Instance, you set a security group to allow all traffic to connect to your Amazon EC2 instance via port 80 (HTTP). Now that you have created an Elastic Load Balancer, you can update your security group to allow only incoming HTTP traffic from your Elastic Load Balancer. Move on to further post Update Your Amazon EC2 Security Group.
AWS SAMPLE RESUME
AMAZON EC2 INTERVIEW QUESTIONS
|AWS Certified SysOps Administrator||AWS Certified Solutions Architect / Professional|
|AWS Certified Developer||AWS Certified DevOps Engineer|
|AWS Technical Essentials||AWS Database Migration Service|
|AWS Lambda 2016||and many more...|
Get Updates on Tech posts, Interview & Certification questions and training schedules