Elastic Load Balancers
A load balancer distributes network traffic across a group of servers.
A load balancer might send an incoming request to the server which is least busy, or might use a round-robin algorithm to forward requests to each server in turn.
Types of load balancers
Application Load Balancer
- Operates at OSI Layer 7
- Application aware
- Load balancing of HTTP and HTTPS traffic
- Supports advanced request routing to specific web servers based on the HTTP header
Network Load Balancer
- Operates at OSI Layer 4
- Most expensive AWS load balancer
- Used in production especially if we have latency as an issue
- Capable of handling millions of requests per second, maintaining ultra-low latencies
- Used for load balancing of TCP traffics where extreme performance is required
Classic Load Balancer
- Not recommended anymore
- Legacy
- Load balance HTTP/HTTPS applications using Layer 7 features
- Load balance applications relying on TCP protocols using strict Layer 4
- Support Layer 7 features such as
X-Forwarded-For
headers and sticky sessions (allows us to keep sending requests originating from the same session to the same web server)
Creating a load balancer
- Create
Load Balancer
fromEC2 Dashboard
- Configure load balancer
- Configure security settings
- Configure security groups
- Configure routing: create target group and add health checks
- Register targets with existing EC2 instances
- Review and create
X-Forwarded-For
The X-Forwarded-For
header allows us to identify the IP address of the client connecting through a load balancer.
Common load balancer errors
-
Error 504 Gateway timeout
- if app stops responding
Revisiting the OSI - 7 layer model
This is a conceptual framework which describes the functions of a network.
Layers | Description |
---|---|
7 (application) | what the end user sees, HTTP, web browsers |
6 (presentation) | data is in a usable format - encryption, ssh |
5 (session) | maintains connections and sessions |
4 (transport) | transmits data using protocols such as TCP and UDP |
3 (network) | logically routes network packages based on IP addresses |
2 (data link) | physically transmits data based on MAC addresses |
1 (physical) | transmits bits and bytes over physical devices |
Route53
Route53 is Amazon's DNS service.
Allows mapping domain names to
- EC2 instances
- Load Balancers
- S3 Buckets
Registering a domain name and mapping to a load balancer
Registering a domain name can take up to 3 days to complete. Once registered, it will automatically appear in the Hosted Zones.
- Select
Route53
fromServices/Network and Content Delivery
. - Click on
Register Domain
. - Choose a domain name and register.
- On successful registration, domain name appears in
Hosted Zones
. - Select
Hosted Zones
and select your hosted zone. - Click on
Create Record
-Turn on alias -> select routing policy -> select record type -> select endpoint, region and load balancer to route traffic to
. - Click
Create Record
to create the record underHosted Zones
.
Top comments (0)