How to ensure session persistence during EC2 failure?
Short answer
C Use Amazon DynamoDB to perform scalable session handling.
Question
Key Takeaways
This question tests the ability to decouple application state from compute resources, with the common trap being confusing sticky sessions (session persistence) with actual data durability.
To prevent session loss during EC2 failures, developers must decouple session data from the instance. The community consensus confirms that Amazon DynamoDB provides the necessary scalability and fault tolerance for session handling.
Common mistake: Choosing Sticky Sessions (Option A) is a common mistake because, while it routes traffic to the same instance, it does not prevent data loss if that specific instance fails.
Expert Analysis
Why the Answer Is Correct
Amazon DynamoDB is a managed NoSQL database that offers high availability and durability across multiple Availability Zones. By storing session data in DynamoDB, the data persists independently of the EC2 instance lifecycle. If an instance fails, a new instance can retrieve the session data from DynamoDB without any loss.
Why the Other Options Are Wrong
Sticky sessions (Option A) bind a user to one instance; if that instance dies, the session dies. Amazon SQS (Option B) is designed for message queuing between services, not for real-time session state retrieval. Connection draining (Option D) only ensures in-flight requests complete before an instance terminates; it does not save session state.
Community Comment Notes
Comment [1] highlights the critical flaw in sticky sessions regarding data loss. Comment [3] reinforces the definition of sticky sessions, helping clarify why it is insufficient for fault tolerance. The community unanimously supports DynamoDB as the robust solution for scalable session handling.
Official Reference
- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/best-practices.html
- https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html#sticky-sessions
These links open the official vendor documentation in a new tab.
Exam Strategy
When questions ask about fault tolerance or data loss prevention regarding sessions, immediately look for options that decouple state from compute. Avoid sticky sessions unless the question specifically asks about maintaining context without requiring persistence across failures.
Community Votes
100% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 3 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 3
-
KennethNg923 👍 3 Answered CSticky sessions ensure that all requests from a particular client are sent to the same EC2 instance. While this can be useful for maintaining session state, it doesn't protect against data loss if an instance fails. If the instance holding a client's session fails, that session data would be lost. C is Correct: Use Amazon DynamoDB to perform scalable session handling. If an EC2 instance fails, the session data stored in DynamoDB remains intact and can be accessed by other instances.
-
rdiaz 👍 2 Answered CC is the best of the options provided
-
lpennington 👍 1A : Sticky sessions — also known as session persistence — is the method that makes it possible for the load balancer to identify requests coming from the same client and to always send those requests to the same server.
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →