Which load-balancing solution meets these requirements?
Use an Application Load Balancer and the X-Forwarded-For headers.
Use a Network Load Balancer (NLB). Enable proxy protocol support on the NLB and the target application.
Use an Application Load Balancer. Register the targets by the instance ID.
Use a Network Load Balancer and the X-Forwarded-For headers.
Explanations:
An Application Load Balancer (ALB) can forward client IP addresses to the target application using theX-Forwarded-Forheader. This is a standard method for preserving the original client IP in HTTP/HTTPS traffic.
While a Network Load Balancer (NLB) can preserve the client IP address when using TCP connections, it does so through the Proxy Protocol. However, the NLB does not natively support HTTP headers likeX-Forwarded-For, which is essential for HTTP/HTTPS applications.
Using an Application Load Balancer and registering targets by instance ID does not directly address the requirement to access client IP addresses. This method focuses on the registration of targets rather than IP preservation, which relies on the use ofX-Forwarded-For.
A Network Load Balancer does not use HTTP headers such asX-Forwarded-For. Instead, it operates at the TCP level, and while it can preserve client IPs through the Proxy Protocol, it is not suited for HTTP/HTTPS traffic handling as described in the requirement.