[For AWS Beginners] A 5-Minute Guide to Amazon ELB!

Hello! I'm Inoue, a Persian cat from Beyond Co., Ltd.'s Shikoku office

This time, I would like to explain about the load balancer provided by AWS!

What is a load balancer?

You may have heard of a load balancer, but simply put, it is a device that balances the load on a server

If there are not many accesses and the server processes only a few requests, there is no problem even if you do not use a load balancer. However, suppose that access to the server becomes concentrated for some reason

At times like these, many people have probably experienced the server becoming slow and the site taking a long time to load

When a server is accessed from the Internet, it processes the request using resources such as the CPU and memory installed on the device

If for some reason access becomes concentrated and the number of requests increases suddenly, the page may display slowly or not at all in the web user's browser. When request processing is delayed, such as when the page displays slowly or not at all, it indicates a high load

When access to the server is concentrated, the load is high

Load balancers are used to prevent sites from slowing down or even not displaying properly under such high load conditions

By distributing the load across multiple servers, you can prevent the load from concentrating on one server

The load balancer mechanism allows us to provide stable services to web users not only in the event of a surge in web access but also in the event of a server failure

The load on a server is not always constant, so in order to provide users with a stable service, it is necessary to introduce a load balancer

What is ELB?

ELB stands for Elastic Load Balancing and is a load balancer provided by AWS

As mentioned above, a load balancer is a system that distributes the load by distributing concentrated access (traffic) to multiple servers or networks. Because it distributes a single load, it is also called a "load distribution device."

In addition to load balancing, it also has a health check function, which allows you to monitor server performance in real time

This allows you to identify an abnormal server, stop sending traffic to that server, and send traffic to other healthy servers, thereby balancing the load

ELB automatically distributes the load and prevents servers from going down

Furthermore, ELB automatically scales according to the load, eliminating the need for administrators (engineers) to manually increase the number of ELBs or upgrade their specifications

If you anticipate a sudden increase in traffic, you can also use AWS Auto Scaling. This allows you to increase or decrease the number of servers according to the amount of requests, preventing server downtime

Another feature of ELB is that it can load balance traffic across EC2 instances even if they are in different availability zones

We recommend enabling multiple Availability Zones for all load balancers.
However, Application Load Balancers require at least two Availability Zones to be enabled.
This configuration allows the load balancer to continue routing traffic.
If one Availability Zone becomes unavailable or loses its healthy targets, the load balancer can route traffic to healthy targets in another Availability Zone.

Reference site:ELB mechanism

■Types of ELBs
There are three types of ELBs: ALB, NLB, and CLB.

ALB This is an abbreviation for 【Application Load Balancer】.
It is a load balancer optimized for HTTP and HTTPS.
It operates at the application layer of the OSI reference model.
It is a single load balancer with enhanced support for HTTP and HTTPS protocols.
It is the most widely used load balancer for web applications.
Because it makes decisions based on the content of requests and other commands, it can distribute traffic at the directory level of the destination URL.
It can also encrypt communication between instances and the load balancer.
Furthermore, it is possible to specify an IP address as the distribution destination.
NLB NLB stands for Network Load Balancer.
It operates in the transport layer of the OSI reference model (the layer responsible for controlling transmitted data).
Because it only sees fragmented data called packets, it cannot perform the same fine-grained distribution as ALB.
Instead, it can be configured to set static IP addresses as distribution destinations, or to transmit the IP address of the client accessing the server directly to the server.
NLB is a modern load balancer designed to handle millions of requests per second while maintaining ultra-low latency and high throughput.
NLB routes traffic to targets within the VPC and can process millions of requests per second while maintaining low latency.
Therefore, it is suitable for servers where a large amount of access (a sudden increase in load) is expected.
CLB This is an abbreviation for 【Classic Load Balancer】.
It is an older type of load balancer within ELB.
It is characterized by its support
for many protocols, including TCP, SSL/TLS, HTTP, and HTTPS.
It provides basic load balancing across multiple EC2 instances and operates at both the request and connection levels.
It is intended for applications built within the EC2-Classic network.
Its weakness is its inability to handle complex configurations, and it is a load balancer that AWS no longer recommends using.

In addition to the three typical AWS ELBs mentioned above, there is also the GLB

GLB stands for Gateway Load Balancer

Gateway Load Balancer makes it easy to deploy, scale, and run third-party virtual network appliances.
Providing load balancing and auto-scaling for your fleet of third-party appliances, Gateway Load Balancer is transparent to the source and destination of your traffic.
This feature makes it ideal for working with third-party appliances in security, network analytics, and other use cases.

Reference site:Elastic Load Balancing

This service has only just been released, so I'd like to learn more about it and then write a separate blog post about it!

Incidentally, when I tested ALB for writing this blog, I found
that simply associating ALB with the test instance resulted in a "403" status code being returned in the access logs.

172.31.4.72 - - [15/Jun/2021:07:59:03 +0000] "GET / HTTP/1.1" 403 4897 "-" "ELB-HealthChecker/2.0"

In that case, I placed an "index.html" file under the document root, put the text "aws test" inside the file, and accessed it from a browser, and successfully received a "200" status code.
*This assumes that Apache is installed on the server.

First, navigate to the document root

[root@ip-172-31-38-25 httpd]# cd /var/www/html

Create a file called "index.html"

[root@ip-172-31-38-25 html]# touch index.html

Write "aws test" in the "index.html" file you created

[root@ip-172-31-38-25 html]# vi index.html

If you want to access the verification instance from your browser, you can do so by entering the public IPv4 address in the Chrome search bar

Let's check the access log again!

172.31.4.72 - - [15/Jun/2021:08:38:35 +0000] "GET / HTTP/1.1" 200 9 "-" "ELB-HealthChecker/2.0"

The status code successfully became "200", and when I checked the "Target Group" in the AWS console, the status of the "Target Group" had also changed from "Unhealthy" to "healthy"!

summary

For example, a load balancer

"This is your job" "I'd like you to do this job"

He is like a boss (command center) in a company

By using a load balancer effectively, you can prevent server downtime and eliminate problems such as delayed site display or the site not displaying at all, which will likely increase the reliability of your site

I would also like to become someone who can do work like a load balancer

Growing every day, moving forward every day.
I must update myself every single day!!!
Thank you for reading to the end.

If you found this article helpful,please give it a "Like"!
7
Loading...
7 votes, average: 1.00 / 17
23,784
X Facebook Hatena Bookmark pocket

The person who wrote this article

About the author

Ayaka Inoue

I belong to the Systems Solutions Department.
I joined Beyond as a founding member of the Shikoku office. I jumped into the IT industry with no prior experience.
As part of the training team, I create curricula and conduct training for new graduates, mid-career hires, and existing members. My
main duties are server operation and maintenance.
Above all, I value our customers' content.
I also belong to the Web Content Business Department and the YouTube team.