Load balancing distributes traffic across multiple servers. Auto Scaling changes capacity based on demand.

Load balancer

A load balancer receives client traffic and forwards it to healthy targets.

Benefits:

In AWS, Application Load Balancer is common for HTTP and HTTPS backend services.

Health checks

Health checks tell the load balancer whether a target can receive traffic.

A good health endpoint checks whether the application process is alive and able to serve basic requests.

Avoid health checks that are too heavy or depend on every downstream service.

Auto Scaling Group

An Auto Scaling Group manages a group of EC2 instances.

It can:

Scaling policies

Scaling can be based on metrics such as:

Choose metrics that represent actual pressure on the service.

Deployment pattern

A common setup:

  1. Load balancer in public subnets.
  2. EC2 instances in private subnets.
  3. Auto Scaling Group manages instances.
  4. Load balancer sends traffic only to healthy instances.

Common mistakes

Quick revision