A developer is designing a serverless e-commerce application that must manage highly dynamic user shopping carts and preferences. The session data must be retrieved with low latency (), must scale automatically to handle millions of concurrent users, and must be automatically deleted after of user inactivity.
Which TWO strategies should the developer implement to meet these requirements? (Select TWO.)
- Store the session data in an Amazon DynamoDB table and enable Time to Live (TTL) on a timestamp attribute.Answer
- Store the session data in an Amazon ElastiCache for Redis cluster and use the Redis EXPIRE command to set a TTL on the session keys.Answer
- CStore the session data in the global execution context of the application's AWS Lambda functions to cache it in memory between invocations.
- DStore the session data in an Amazon DynamoDB table and retrieve active sessions using Scan operations filtered by session state.
- EStore the session data in AWS Systems Manager Parameter Store and configure AWS Secrets Manager to automatically rotate the sessions.
Answer
Store the session data in an Amazon DynamoDB table with Time to Live (TTL) enabled, or store the session data in an Amazon ElastiCache for Redis cluster using the EXPIRE command to automatically expire keys.
Storing session data in Amazon DynamoDB with TTL and storing session data in Amazon ElastiCache for Redis using the EXPIRE command are correct because both offer the required low latency, high scalability, and support automatic expiration of data after a period of inactivity. DynamoDB TTL deletes items automatically based on a timestamp, and Redis EXPIRE deletes keys after a specified number of seconds.
Step-by-Step Solution
Key Concept
Implementing session state management with automatic TTL-based cleanup in highly scalable databases and in-memory caches.