AWS
DevOps
  • knowledge
    • glossary
    • network knowledge
      • CIDR Block
      • OSI
      • List of Ports
      • Network model
    • AWS best practices
      • Least privilege principle
      • Support Plan
      • Well-architected framework
        • Well-architected framework
        • Cost optimization
        • Operational Excellence
        • Performance efficiency
        • Reliability
        • Security
    • Exams
      • DOP-C02
        • DOP-C02 topics
        • DOP-C02 Labs
      • DVA-C02
      • SOA-C02
  • services
    • access management
      • Directory Service
      • IAM
        • PassRole
      • IAM Identity Center (SSO)
      • Organizations
        • Organizational Unit
        • Control Tower
      • AD Domain Service
    • analytics
      • data analytic
        • Athena
        • QuickSight
        • Redshift
      • data collection
        • Data Lake
        • Lake Formation
      • data processing
        • EMR
        • Kinesis
        • Glue
          • Glue Data Catalog
      • OpenSearch
    • compute
      • Batch
      • EC2
        • Auto Scaling
        • AMI
        • ELB
          • Global accelerator
        • Security Group
        • EBS
        • EC2 Instance Store
        • Spot Fleet
      • Elastic Beanstalk
      • Lambda
        • Layer
        • Lambda API
      • Outposts
      • Wavelength
      • SAM
      • VMWare Cloud
    • container
      • Copilot
      • ECR
      • ECS
        • ECS Anywhere
      • EKS
        • EKS Anywhere
        • EKS Distro
      • Fargate
    • cost management
      • Budgets
      • Cost Explorer
      • Saving Plans
      • Compute Optimizer
    • database
      • Data Engineer
      • Document DB
      • DynamoDB
        • DynamoDB API
        • Scan
      • ElastiCache
      • Keyspaces
      • MemoryDB for Redis
      • Neptune
      • Quantum Ledger Database
      • RDS
        • Aurora
          • Aurora Global Database
          • Aurora Serverless
      • Timestream
    • devTools
      • CICD
        • CodeArtifact
        • CodeCommit
        • CodeBuild
        • CodeDeploy
        • CodePipeline
      • CloudFormation
      • CodeGuru
      • CodeStar
      • CodeWhisperer
      • X-Ray
      • Deployment strategies
    • finance
      • Cost explorer
    • integration
      • AppFlow
      • AppSync
      • EventBridge
      • MQ
      • SNS
      • SQS
      • Step Functions
      • SWF
    • management
      • AppConfig
      • AWS Backup
      • AWS CDK
      • Config
      • Grafana
      • Health Dashboard
      • Proton
      • Service Catalog
      • System Manager
      • SSM
      • Resource Group
      • OpsWorks (discontinued)
    • media
      • Elemental MediaConvert
      • Transcoder
    • messaging
      • SES
    • migration
      • Application Migration Service
      • DataSync
      • DMS
      • Migration Evaluator
      • Migration Hub
      • Server Migration Service
      • Snow Family
      • Transfer Family
    • ML
      • Comprehend
      • Forecast
      • Kendra
      • Lex
      • Rekognition
      • SageMaker
        • SageMaker Data Wrangler
        • SageMaker ML Lineage Tracking
    • monitoring
      • CloudTrail
      • CloudWatch
      • TrustedAdvisor
    • networking
      • CloudFront
      • Customer gateway
      • Edge Location
      • hybrid networking
        • Direct Connect
          • Direct Connect Gateway
        • Site-to-site VPN
      • PrivateLink
      • Region
        • AZ
      • Route 53
      • Transit Gateway
      • VPC
        • VPC Lattice
        • Subnet
          • NACL
        • Internet Gateway
        • Network Firewall
        • VPN
        • NAT Gateway
      • Virtual Private Gateway
    • security
      • Artifact
      • ACM
      • CloudHSM
      • Cognito
      • Detective
      • Firewall Manager
      • GuardDuty
      • Inspector
      • KMS
      • Macie
      • Network Firewall
      • Resource Access Manager
      • Security Hub
      • Secret Manager
      • Secret Hub
      • Shield
      • STS
      • Trusted Advisor
      • WAF
    • storage
      • Backup
      • EBS
      • EFS
      • FSx
      • S3
        • S3 Glacier
        • S3 Snippet
        • S3 Mountpoint
      • Snow family
      • Storage gateway
      • WorkDocs
    • web & mobile
      • Amplify
      • API Gateway
      • Device Farm
      • Pinpoint
Powered by GitBook
On this page
  • Overview
  • Use cases
  • Features
  • ELB Sticky Session
  • ELB Health Checks
  • Cross Zone Load Balancing
  • SSL certificate
  • Server Name Indication
  • Trivia
  • Concepts
  1. services
  2. compute
  3. EC2

ELB

Elastic Load Balancer

PreviousAMINextGlobal accelerator

Last updated 1 year ago

|

Overview

  • Distribute traffic across AZs.

  • AWS has 4 kinds of load balancers:

    • 3 popular ELB are:

-
ALB (L7)
NLB (L4)
CLB (old)

protocol

HTTP, HTTPS, Websocket, gRPC

TCP, TLS (secure TCP), UDP

HTTP, HTTPS, TCP, SSL

DNS Name

Yes

Yes

Yes

Static IP

No

Yes

No

Benefit

route traffic to different Target group based on URL Path, Hostname, HTTP headers, and Query Strings.

  • Highest performance

  • Lowest latency

Target group

  • EC2 instance

  • private IP add

  • ALB

Health check

Support HTTP, HTTPS, TCP

Note

  • Reserved cookie names: AWSALB, AWSALBAPP, AWSALBTG.

  • To get the client's IP address, ALB adds an additional header called X-Forwarded-For contains the client's IP address.

has 1 static IP /AZ -> can attach Elastic IP

  • Gateway Load Balancer (L3 - Network layer)

Use cases

  • Adding elasticity to your application. (+ with Route53 ).


Features

ELB Sticky Session

  • Ensures traffic for the same client is always redirected to the same target (e.g., EC2 instance). This helps that the client does not lose his session data. To use sticky sessions, the client must support cookies.

  • Sticky sessions are enabled at the target group level.

  • ALB use the Expires attribute in the cookie header instead of the Max-Age attribute.

  • Sticky sessions rely on a cookie that is not going to be consistent across devices.

With cross-origin resource sharing (CORS) requests, some browsers require SameSite=None; Secure to enable stickiness.

ELB Health Checks

  • When you enable ELB Health Checks, your ELB won't send traffic to unhealthy (crashed) EC2 instances.

  • When an EC2 instance fails the ALB Health Checks, it is marked unhealthy and will be terminated while the ASG launches a new EC2 instance.

Cross Zone Load Balancing

When Cross-Zone Load Balancing is enabled, ELB distributes traffic evenly across all registered EC2 instances in all AZs.

ALB
NLB
CLB

enabled by default

disabled by default

disabled by default

free

$ for inter-AZ

free

SSL certificate

Manage certificates using ACM (AWS Certificate Manager)

Server Name Indication

Allow you load multi SSL certificates on one listener.


Trivia

  • Only NLB provides both static DNS name and static IP. While, ALB & CLB provide a static DNS name but it does NOT provide a static IP.

  • When using an ALB to distribute traffic to your EC2 instances, the IP address you'll receive requests from will be the ALB's private IP addresses. To get the client's IP address, ALB adds an additional header called X-Forwarded-For contains the client's IP address.

  • ELB waits 300 seconds before the completion of the deregistration process, which can help in-flight requests to the target become complete. To change the amount of time that Elastic Load Balancing waits, update the deregistration delay value.


Concepts

  • gRPC (Remote Procedure Call): a protocol, a way that different parts of a computer program can talk to each other, even if they are on different computers or in different places.

Sticky sessions are not supported if .

Only ALB support .

cross-zone load balancing is disabled
gRPC
Sticky session
X.509 certificate
Weighted Routing policy