Elastic Load Balancing

  • Elastic Load Balancing automatically distributes your incoming traffic across multiple targets
  • Such as EC2 instances, containers, and IP addresses, in one or more Availability Zones.
  • EC2 > Load Balancing

Types of load balancers

  • Application Load Balancers
  • Network Load Balancers
  • Gateway Load Balancers
  • Classic Load Balancers (Deprecated)

Target Groups

  • EC2 > Load Balancing > Target groups > Create target group
    • Choose a target type > Instances
    • Available instances > Select instance > include as pending below

Application Load Balancers

  • Load Balancer type: Layer 7
  • Protocol listeners: HTTP, HTTPS, gRPC
  • EC2 > Load balancers > Create Application Load Balancer
    • Scheme > Internet-facing
    • Listeners and routing > add target group
      • Protol: HTTP
  • Select load balancer > Listeners > View/edit rules
    • Add rules > Insert Rules
  • Can be filtered(load-balance) based on
    • sub-domain
    • path
    • query string …

NOTE

  • IP
    • IPv4 settings –> Assigned by AWS
  • Target-group
    • Create it using HTTPs

Sticky sessions for your Application Load Balancer

  • By default, an Application Load Balancer routes each request independently to a registered target based on the chosen load-balancing algorithm.
  • The sticky session feature enable the load balancer to bind a user's session to a specific target
  • Application Load Balancers support both
    • Duration-based cookies and
      • AWSALB is the only name used across all target groups.
    • Application-based cookies
      • Here cookie names have to be specified individually for each target group

Network Load Balancers

  • Load Balancer type: Layer 4
  • Protocol listeners: TCP, UDP, TLS
  • EC2 > Load balancers > Create Network Load Balancer
    • Scheme > Internet-facing
    • Listeners and routing > add target group
      • Protol: TCP

NOTE

  • IP
    • IPv4 settings –> Assigned by AWS or Assign Elastic IP
  • Target-group
    • Create it using TCP

Amazon EC2 Auto Scaling

  • It helps you ensure that you have the correct number of Amazon EC2 instances available to handle the load for your application.
  • It launch or terminate instances as demand on your application increases or decreases.
  • Scale in and Scale out
  • Types
    • Vertical Scaling
      • Increase Compute power of current instance
    • Horizontal Scaling
      • Launch some paraller instances
      • By default profided by AWS
  • EC2 > Auto Scaling > Auto Scaling Groups > Create
    • Launch template
    • Attach/Create Load balancer