Lesson 1 of 10 Serverless and API Architecture

Choosing an Ingress Front Door: API Gateway, ALB or NLB

This lesson compares API Gateway, Application Load Balancers and Network Load Balancers, explains Kubernetes ingress with the AWS Load Balancer Controller, and shows how traffic patterns decide the most cost-effective choice.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish the features and pricing of API Gateway, ALB and NLB.
  • Explain how the AWS Load Balancer Controller creates and shares load balancers for EKS.
  • Choose a front door, or a combination, from protocol, feature and traffic requirements.

The three front doors

Amazon API Gateway

API Gateway is an API management service. REST APIs offer request validation, API keys with usage plans (quotas and throttling per client), caching, request and response transformation, AWS WAF integration, private APIs reachable only through interface VPC endpoints, and Lambda, Cognito or IAM authorisers. HTTP APIs are cheaper and faster but simpler, with JWT authorisers and no usage plans. WebSocket APIs keep persistent connections. API Gateway charges per request, so it suits spiky or low-volume APIs, and its integration timeout (29 seconds by default) favours short requests.

Application Load Balancer

An ALB routes HTTP, HTTPS and gRPC by host, path, header, method and query string to EC2, IP, Lambda or container targets; authenticates users with Cognito or any OIDC provider; supports weighted target groups for blue/green; integrates with AWS WAF; and charges per hour plus load balancer capacity units, which is economical for steady, high request volumes.

Network Load Balancer

An NLB balances TCP, UDP and TLS at layer 4 with very high throughput and low latency, keeps a static IP address (or Elastic IP) per Availability Zone, preserves client IP addresses, and can front a PrivateLink endpoint service. It suits non-HTTP protocols, allow-listed IP addresses and extreme scale.

Kubernetes ingress with the AWS Load Balancer Controller

On Amazon EKS, the AWS Load Balancer Controller creates and configures ALBs from Kubernetes Ingress resources and NLBs from Service resources of type LoadBalancer. It can register pod IP addresses directly as targets (IP mode), which removes a hop through node ports. An IngressGroup merges several Ingress resources into one shared ALB, so dozens of services do not each pay for a load balancer, and annotations attach WAF web ACLs and certificates.

Choosing for the usage pattern

The following comparison summarises how the front doors differ.

API Gateway (REST)
ProtocolsHTTPS, WebSocket (WebSocket APIs)
Per-client quotas and API keysYes (usage plans)
Static IP addressesNo
PricingPer request
Choose when APIs needing management features or with low, spiky traffic.
ALB
ProtocolsHTTP, HTTPS, gRPC
Per-client quotas and API keysNo
Static IP addressesNo (use Global Accelerator)
PricingPer hour and capacity units
Choose when Steady, high-volume HTTP traffic with content-based routing.
NLB
ProtocolsTCP, UDP, TLS
Per-client quotas and API keysNo
Static IP addressesYes, per AZ
PricingPer hour and capacity units
Choose when Non-HTTP protocols, static IPs, PrivateLink or extreme throughput.

Front doors are often combined: CloudFront with AWS WAF in front of an ALB for a global web application, API Gateway with a VPC link to an internal ALB or NLB for private back ends, or Global Accelerator in front of NLBs for static anycast IP addresses.

Sort into groups

Which front door?

Exam skills 1.1.10

Choose the ingress service that suits each usage pattern.

Log in to try this activity Interactive activities are free with an account.
Worked example

Three kinds of traffic

A company has a public partner API with 2,000 requests a day and per-partner quotas, a web storefront with millions of requests a day on EKS, and a telemetry protocol over UDP from field devices whose firewalls allow only fixed IP addresses.

The partner API uses an API Gateway REST API with usage plans and API keys, which costs little at that volume.

The storefront uses the AWS Load Balancer Controller with one IngressGroup, so its 25 services share an ALB behind CloudFront and AWS WAF. The telemetry ingestion uses an NLB with Elastic IP addresses in each Availability Zone and a UDP listener.

Check yourself

Thirty Kubernetes Ingress resources each created their own ALB. How can they share one?

Show answer

Assign them to the same IngressGroup with the AWS Load Balancer Controller's group annotation, so the controller merges their rules into one ALB.

Exam Tips

Remember for the exam

  • Per-client quotas, API keys and request validation: API Gateway REST API with usage plans.
  • Static IPs, UDP or millions of requests per second: NLB.
  • Kubernetes Ingress creating ALBs automatically: AWS Load Balancer Controller; share one ALB with an IngressGroup.
  • Low, spiky traffic is cheaper per request on API Gateway; steady high volume is cheaper on an ALB.