AWS Certified Solutions Architect – Associate (SAA-C03)Design Resilient ArchitecturesMedium
A media company is developing a new streaming service. They need to ensure that user sessions are maintained consistently, even if the underlying EC2 instance serving a user's request becomes unhealthy or is terminated. The application runs on EC2 instances behind an Application Load Balancer (ALB). Which ALB feature should be enabled to meet this requirement?
- ASticky sessions (session affinity).
- BTarget group health checks.
- CCross-zone load balancing.
- DPath-based routing.
Show answer & explanationAnswer & explanation
Correct answer: A. Sticky sessions (session affinity).
Sticky sessions, also known as session affinity, ensure that requests from a user are consistently routed to the same target (EC2 instance). While this helps maintain session state on a specific instance, it can reduce load balancing effectiveness. However, the question specifically asks for maintaining user sessions, making sticky sessions the direct solution.
Why the other options are wrong
- B. Target group health checks monitor the health of registered targets and route traffic only to healthy instances, which is crucial for availability but doesn't maintain session state across instances.
- C. Cross-zone load balancing distributes traffic evenly across all registered targets in all enabled Availability Zones, which is for fault tolerance and even distribution, not session persistence.
- D. Path-based routing directs requests to different target groups based on the URL path, which is for microservices routing, not session persistence.
ALB Sticky Sessions
An Application Load Balancer feature that binds a user's session to a specific target (EC2 instance), ensuring that all requests from that user during the session are sent to the same target.
- Maintains session state on a specific instance.
- Can be cookie-based.
- Can reduce load balancing effectiveness if overused.
Memory trick: Sticky sessions, like glue, keeps users with their instance, it's true.