When should I use AWS NLB instead of ALB?

461 views Asked by At

I am familiar with both AWS ALB and NLB, but I'm unsure about the scenarios in which NLB would be more suitable, given that ALB can handle similar tasks. Are there specific use cases where NLB is preferred, or could it be related to pricing considerations?

2

There are 2 answers

1
Yogi On BEST ANSWER

Use AWS Network Load Balancer (NLB) when:

  • Load balancing needs are at Layer 4 (TCP/UDP) or for non-HTTP protocols.
  • High throughput and low latency are essential.
  • Static IP addresses are required.
  • Routing traffic for containers, microservices, or cross-zone load balancing. -Managing highly available, fault-tolerant applications.

For HTTP/HTTPS-based routing and advanced content inspection, choose AWS Application Load Balancer (ALB). In many cases, both NLB and ALB can be used together for a complete load-balancing solution.

0
beshr On

AWS NLB and ALB are similar in case:

  • Both NLB and ALB can terminate SSL cert and pass the request in HTTP to the target group.
  • Both support ECS
  • Both are highly available since they support multi availability zones.

NLB is best when:

  • You need Layer 4 type of requests when using TCP/UDP ports. For example, if you have many applications and they are defined with ports.
  • You need low latency.
  • you need a fixed IP of the LB to use it with 3rd party DNS management tool to use it for A records where the ALB IP addresses change and can't be used for A records.

ALB is best when:

  • Major benefit: Can be associated with WAF to protect your applications from DDoS or other attacks.
  • You have many applications using HTTP/HTTPS endpoints and you need to route them based on hosts (domains or sub-domains) to different target groups using one LB because it is efficient (HTTPS: app1.com -> target group 1, app2.com target group2, auth.app1.com -> target group3, etc).
  • Support HTTP/HTTPS redirects like from www.example.com to example.com or something else or return a fixed response like 404 with or without a body.
  • You can filter based on hosts, path (like /auth or /checkout) or even source IP to certain target groups.

With modern web applications, ALB will give you more flexibility to manage the routes to your applications.

Final note: you can also use them together to give you a mix of these features.