DEV Community

Manoj Kumar Patra
Manoj Kumar Patra

Posted on

AWS Basics - Beginner's Guide to ELB

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

  1. Create Load Balancer from EC2 Dashboard
  2. Configure load balancer
  3. Configure security settings
  4. Configure security groups
  5. Configure routing: create target group and add health checks
  6. Register targets with existing EC2 instances
  7. 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.

  1. Select Route53 from Services/Network and Content Delivery.
  2. Click on Register Domain.
  3. Choose a domain name and register.
  4. On successful registration, domain name appears in Hosted Zones.
  5. Select Hosted Zones and select your hosted zone.
  6. Click on Create Record - Turn on alias -> select routing policy -> select record type -> select endpoint, region and load balancer to route traffic to.
  7. Click Create Record to create the record under Hosted Zones.

Top comments (0)