SAA-C03 Question 199
Single answerYour company is hosting a web application on Amazon EC2 instances behind an Application Load Balancer (ALB). The application must handle requests for multiple domains, such as 'example.com' and 'api.example.com', and route them to different target groups based on the domain name. Which feature of the Application Load Balancer should you use to meet this requirement?
- A
Host-based routing
- B
Path-based routing
- C
Cross-zone load balancing
- D
Sticky sessions
Show answer and explanation
Correct answer: A
Explanation
To route requests to different target groups based on domain names like 'example.com' and 'api.example.com', you can use the Application Load Balancer's host-based routing feature. This allows the ALB to inspect the HTTP Host header and forward traffic to the appropriate target group based on the domain name.
- A. Correct.
Host-based routing allows the Application Load Balancer to route requests based on the domain name in the HTTP Host header, making it the correct solution for handling multiple domains.
- B. Incorrect.
Path-based routing routes requests based on the URL path, not the domain name, so it is not suitable for differentiating between 'example.com' and 'api.example.com'.
- C. Incorrect.
Cross-zone load balancing ensures traffic is distributed evenly across all targets in all enabled Availability Zones but does not help in routing requests based on domain names.
- D. Incorrect.
Sticky sessions (session affinity) allow requests from a client to be sent to the same target but are unrelated to routing requests based on domain names.