I am new to AWS. I can't get a clear idea behind ALB vs NLB. Could anyone explain in a simple way?
2 Answers
There are some excellent answers out there already, let me pick out some key points that may help.
Network Load Balancer
As the name implies, this is for the network levels only. Typically layer 4. It does not care, nor see, about anything regarding the application layer, such as cookies, headers, etc.
It is context-less, caring only about the network-layer information contained within the packets it is directing this way and that.
the 'balancing' done here is done so solely with IP addresses, port numbers, and other network variables.
Application Load Balancer
This takes into account multiple variables, from the application to the network. It can route its traffic based on this.
It is context-aware and can direct requests based on any single variable as easily as it can a combination of variables.
Key Differences
The network load balancer just forward requests whereas the application load balancer examines the contents of the HTTP request header to determine where to route the request
Network load balancing cannot assure availability of the application, where as Application load balancing can.
Some good sources from where I extracted this information are:
https://linuxacademy.com/community/show/22677-application-load-balancer-vs-network-load-balancer/
https://aws.amazon.com/elasticloadbalancing/features/#compare

- 859
- 8
- 22
-
5Your "key differences" have some inaccuracy. NLB does not forward *requests* at all, because *requests* are Layer 7. NLB routes *connections*. NLB has health checks just like ALB so it isn't clear what you mean about *"cannot assure availability of the application"*. – Michael - sqlbot Apr 17 '20 at 22:55
-
1@Michael-sqlbot apologies for the inaccuracy about forwarding requests, I agree with your remark. As for your second point, the NLB can health check servers from TCP handshakes etc. But in terms of the actual client facing application, it has no awareness of? – james Apr 17 '20 at 23:02
-
2That's true, depending on what the "application" is. If it's a web app, it's unlikely that an NLB is the right choice. – Michael - sqlbot Apr 17 '20 at 23:25
In main response by @james above, network level has been defined multiple times and mentions about network layer information. However, I would like to mention, NLB yes operates on Layer4, but Layer4 is Transport Layer not Network Layer. NLB preserves source IP and thus Elastic IP can be used in case of NLB.

- 1