SAA-C03 Question 342
Single answerA company is running an e-commerce application on Amazon EC2 instances behind an Application Load Balancer (ALB). The application stores session data on the local disk of each EC2 instance, but the company is experiencing issues with session persistence when instances are replaced during scaling operations. As a Solutions Architect, which solution would you recommend to ensure session data is preserved during scaling events?
- A
Store session data in Amazon S3 and retrieve it for each user session.
- B
Enable sticky sessions (session affinity) on the Application Load Balancer.
- C
Store session data in Amazon DynamoDB for a highly available and scalable solution.
- D
Use Amazon ElastiCache to store and retrieve session data.
Show answer and explanation
Correct answer: C
Explanation
To ensure session data is preserved during scaling events, a solution must decouple session storage from individual EC2 instances. Amazon DynamoDB provides a highly available, durable, and scalable solution for managing session data, making it the most appropriate choice in this scenario. While other options like sticky sessions or ElastiCache could work, they either introduce dependencies or add unnecessary complexity compared to DynamoDB.
- A. Incorrect.
Storing session data in Amazon S3 is not suitable for session management because S3 is designed for object storage, not low-latency session data retrieval.
- B. Incorrect.
Enabling sticky sessions on the Application Load Balancer could partially solve the issue, but it introduces dependencies on specific instances and doesn't address instance replacement during scaling.
- C. Correct.
Amazon DynamoDB is a highly available and scalable NoSQL database, making it an excellent choice for storing session data. It ensures session persistence and is not tied to specific EC2 instances.
- D. Incorrect.
Amazon ElastiCache could be used for session storage, but it introduces additional complexity and depends on the availability of the cache nodes. While viable, it is not as robust as DynamoDB for this use case.