Search code examples
amazon-web-servicesamazon-elbnlb

In AWS, why is that an NLB can provide static IP addresses whereas an ALB cannot?


As per AWS,

Network Load Balancer routes traffic to targets within Amazon Virtual Private Cloud (Amazon VPC) and is capable of handling millions of requests per second while maintaining ultra-low latencies

Also, NLB supports static / Elastic IP addresses. I am under the impression that AWS generally does not recommend IP addresses but instead asks clients to use DNS names so that the underlying hardware can scale (and IP addresses can change). How is this possible in the case of NLB where IP can remain static and still scale but the same functionality is not offered on ALB? - Is it a design limitation of ALB that AWS improved in NLB? Or any technical challenges to retain static IP in case of ALB?


Solution

  • Don't know if this is full explanation behind AWS use of IP addresses in ALB and NLB, but I think that this is because ALB works at application layer (layer 7) of the OSI model.

    At layer 7, apart form HTTP, HTTPS, FTP you also have DNS. Thus, you use DNS as the primary way of communicating with ALB and this is what AWS tells you to do.

    NLB works at transport layer (layer 4) of the OSI model. Here there is no DNS, but TCP or UDP for instance. Thus when you want to communicate with NLB, you need to use IP address, as technically there is no DNS nor URLs.

    The fact that AWS provides DNS for NLB is only usable for applications that use NLB and operate on layer 7, such as when you use NLB to load balance HTTPS/HTTP traffic, or ssh to an instance through NLB. But NLB can be used for application that only operate at layer 4, or use custom/proprietary higher level protocols, thus they must use IP address, as DNS is not available at layer 4. So obviously the IP addresses of NLB must be static, otherwise such applications would break.