Application Load Balancer (ALB)

Beginner
11 min read
Updated: Nov 2026
5 examples
Console walkthrough

Definition and Usage

An Application Load Balancer (ALB) is Elastic Load Balancing’s Layer 7 load balancer. It gives clients one DNS name, then spreads HTTP and HTTPS requests across healthy targets such as EC2 instances in multiple Availability Zones.

What problem does an ALB solve?

A single server is a single point of failure and a capacity ceiling. An ALB fronts your app so you can add or remove targets without changing the public URL, keep serving traffic when one instance fails health checks, and later add host or path rules for more advanced routing.

When should you use an ALB?

Use an ALB for web apps and APIs that speak HTTP/HTTPS. Prefer a Network Load Balancer (NLB) when you need extreme Layer 4 performance, static IPs, or non-HTTP protocols. Pair the ALB with a target group, then add ACM for HTTPS and HTTP to HTTPS redirects for production.

How traffic flows

Client → ALB listener (port/protocol) → listener rules → target group → healthy registered targets. Health checks run per target group so unhealthy instances stop receiving new requests.

Internet-facing vs internal

Choose Internet-facing for public websites (needs public subnets). Choose Internal when only resources inside your VPC should reach the load balancer.

Layer 7 routing.

Beyond simple round robin, ALB rules can match host, path, headers, query strings, and HTTP methods—useful for microservices behind one hostname. See path-based routing.

Two Availability Zones minimum.

AWS requires subnet mappings in at least two AZs. Put healthy targets in those zones (or understand cross-zone behaviour) so traffic has somewhere to go.

Not a substitute for DNS alone.

Point your domain at the ALB with Route 53 alias records when you leave the raw ALB DNS name behind.

Core Concepts

Terms you will see while creating an ALB:

ConceptMeaning
ListenerChecks for connections on a protocol/port (e.g. HTTP:80, HTTPS:443)
Listener ruleConditions + actions; every listener needs a default forward/redirect/fixed response
Target groupRegistered backends plus health checks and routing algorithm
SchemeInternet-facing (public) or internal (VPC-only)
Network mappingVPC + subnets in ≥ 2 Availability Zones
Security groupsFirewall rules for client→ALB and ALB→target traffic
DNS nameAWS-managed hostname clients use until you map a custom domain

Prerequisites

Have these ready before you create the load balancer:

  • An AWS account with access to EC2 and Elastic Load Balancing.
  • A target group with at least two healthy EC2 (or other) targets—ideally in different AZs.
  • A VPC with public subnets in at least two Availability Zones for an internet-facing ALB.
Target health matters.

The ALB only forwards to healthy targets. Confirm health checks pass before testing the DNS name.

Examples

Create an internet-facing ALB in front of two demo apps (React and Next.js) so you can see traffic move between targets.

Example 1 — Prepare Distinct EC2 Targets

Use two different apps so refreshes can show which instance answered.

  • React on one EC2 instance.
  • Next.js on another EC2 instance.
Two EC2 instances registered as targets behind a load balancer
EC2 and target group

How It Works

  1. Register both instances in the same target group (or follow Target groups and ALB).
  2. Health checks must pass on each instance’s app port/path.
  3. Different apps make routing visible—refreshing the ALB URL may show React or Next.js.
  4. Production tip: identical replicas are usual; this mix is only for learning.

Example 2 — Create an Internet-Facing ALB

Start the wizard and set the basic identity of the load balancer.

  1. Open the AWS Management Console and go to Load Balancers.
  2. Choose Create load balancer, then Application Load Balancer.
  3. Under Basic configuration, set a name, scheme Internet-facing, and IP type IPv4 (unless you need dualstack).
Elastic Load Balancing console with Create load balancer
AWS Management Console
ALB basic configuration name scheme and IP type
Elastic Load Balancing

How It Works

  1. ALB is the Layer 7 choice in the ELB family for HTTP/HTTPS apps.
  2. Internet-facing places nodes so the public internet can reach the listeners.
  3. The name is for you in the console and APIs; clients will use the DNS name AWS assigns.
  4. IPv4 is the common default for first tutorials; dualstack needs IPv6-ready subnets.

Example 3 — Map AZs and Security Groups

Place the ALB in your VPC and open the ports clients and targets need.

  1. Under Network mapping, select the VPC and subnets in at least two Availability Zones where your targets live.
  2. Under Security groups, allow inbound client traffic on listener ports (typically 80 / 443).
  3. Ensure target security groups allow traffic from the ALB on the application and health-check ports.
ALB network mapping VPC and subnet selection
Elastic Load Balancing
ALB security group selection
Elastic Load Balancing

How It Works

  1. Multi-AZ mapping lets AWS keep serving if one zone fails.
  2. Public subnets are required for an internet-facing ALB’s nodes.
  3. Security groups are stateful firewalls—open client→ALB and ALB→target paths explicitly.
  4. You can attach up to five security groups to the load balancer.

Example 4 — Add Listeners and Finish Create

Tell the ALB which ports to accept and where to forward by default.

  1. Under Listeners and routing, keep or add HTTP on port 80 with default action Forward to your target group.
  2. Optional: add HTTPS on 443 with an ACM certificate when you have a domain.
  3. Choose Create load balancer and wait until the state is Active.
ALB listeners and default routing to a target group
Elastic Load Balancing
Create Application Load Balancer confirmation
Elastic Load Balancing
ALB provisioning state and DNS name
Elastic Load Balancing

How It Works

  1. A listener accepts connections on one protocol and port.
  2. The default rule must send traffic somewhere (usually a target group).
  3. HTTPS needs a certificate from ACM in the same Region as the ALB.
  4. Active means nodes are ready; copy the DNS name for the next test.

Example 5 — Open the ALB DNS Name

Confirm requests reach healthy targets through the single public hostname.

  1. Copy the ALB DNS name from the console.
  2. Open it in a browser (HTTP on port 80 for this demo).
  3. Refresh several times—you may see the React app, then Next.js, as the ALB picks targets.
Browser showing React app via ALB DNS name
Browser
Browser showing Next.js app via same ALB DNS name
Browser

How It Works

  1. One DNS name, many backends—clients never need individual instance IPs.
  2. Default algorithm is round robin; stickiness, caching, or keep-alive can hide switching.
  3. Refresh more than once if you do not see both apps immediately.
  4. Next steps: map a custom domain in Route 53, add HTTPS with ACM, and redirect HTTP to HTTPS.

Edge Cases & Pitfalls

Most ALB “it doesn’t work” moments are health checks, security groups, or empty Availability Zones.

health

Unhealthy targets get no traffic

If every target fails health checks, the ALB returns errors. Match the health-check path, port, and success codes to your app.

sg

Security groups block the path

Open client→listener ports on the ALB group, and ALB→target ports on the instance groups. Missing either side looks like a dead site.

az

AZs without targets

Enable only AZs that have (or will have) targets, or plan capacity so remaining zones can absorb a zonal failure.

stickiness

Sticky sessions hide round robin

If stickiness is on, browsers may keep hitting one instance. Turn it off while demonstrating distribution.

https

Certificate Region mismatch

ACM certificates for an ALB must be in the same Region as the load balancer. CloudFront is the special case that needs us-east-1.

idle

Idle timeout vs long requests

Long uploads or slow APIs can hit the ALB idle timeout. Raise it carefully or make the app send keep-alive traffic.

Key Takeaways

  • Role: an ALB is a Layer 7 front door that spreads HTTP/HTTPS across healthy targets.
  • Setup: map ≥ 2 AZs, attach security groups, and forward listeners to a target group.
  • Health: only healthy targets receive traffic—fix checks before debugging the DNS name.
  • Next: add ACM HTTPS, redirects, and Route 53 when you leave the demo DNS name.

One line: one ALB DNS name, healthy multi-AZ targets, listeners that forward to a target group.

Frequently Asked Questions

An Application Load Balancer (ALB) is a Layer 7 load balancer that distributes HTTP and HTTPS traffic across targets such as EC2 instances, IP addresses, or containers in one or more Availability Zones within a Region.
ALB works at Layer 7 and is ideal for HTTP/HTTPS with host, path, header, and method routing. A Network Load Balancer (NLB) works at Layer 4 (TCP/UDP/TLS) and is built for ultra-high performance, static IPs, and connection-level features.
You must map subnets in at least two Availability Zones so AWS can place redundant load balancer nodes. That improves fault tolerance if one zone has issues.
Yes. The ALB continuously health-checks registered targets in each target group used by a listener rule and routes requests only to targets that pass those checks.
The default is round robin. You can also choose least outstanding requests at the target group level. Sticky sessions can make the same client keep hitting one target.
No. You can start with an HTTP listener on port 80. For production, add an HTTPS listener on 443 with an ACM certificate, then redirect HTTP to HTTPS.

Next: Network Load Balancer

Compare Layer 4 NLB—static IPs, TCP/UDP, and when to skip ALB.

NLB overview →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful