AWS Certified Developer - Associate DVA-C02 Exam QuestionsBrowse all questions from this exam

AWS Certified Developer - Associate DVA-C02 Exam - Question 347


A developer is writing an application to analyze the traffic to a fleet of Amazon EC2 instances. The EC2 instances run behind a public Application Load Balancer (ALB). An HTTP server runs on each of the EC2 instances, logging all requests to a log file.

The developer wants to capture the client public IP addresses. The developer analyzes the log files and notices only the IP address of the ALB.

What must the developer do to capture the client public IP addresses in the log file?

Show Answer
Correct Answer: D

When using an Application Load Balancer, the client's public IP address is not directly visible to the backend EC2 instances. Instead, the client IP address is included in the `X-Forwarded-For` HTTP header by the ALB. To capture the client public IP addresses in the log files, the developer needs to configure the HTTP server to log the `X-Forwarded-For` header. This header contains the original client IP address, allowing proper tracking of traffic sources.

Discussion

3 comments
Sign in to comment
608064aOption: D
May 19, 2024

D. Add an X-Forwarded-For header to the HTTP server log configuration file. The `X-Forwarded-For` header is used to capture the original client IP address when requests are routed through a load balancer like the ALB.

65703c1Option: D
May 25, 2024

D is the correct answer.

cachacOption: D
Jul 1, 2024

X-Forwarded-For: This header helps you accurately determine the public IP address of the client