An application hosted on Amazon EC2 instances behind an Application Load Balancer requires a distributed, highly available session state store. The store must support low-latency read and write operations, automatically delete expired sessions to manage storage growth, and replicate data across multiple Availability Zones to ensure high availability. Which TWO solutions should a developer implement to meet these requirements? (Select TWO.)
- Store session data in an Amazon DynamoDB table and enable Time to Live (TTL) on a session expiration attribute.Answer
- Store session data in an Amazon ElastiCache for Redis replication group with Multi-AZ enabled and configure key expiration on session keys.Answer
- CStore session data in Amazon Systems Manager Parameter Store parameters.
- DStore session data in an Amazon DynamoDB table and run a recurring AWS Lambda function that performs a Scan operation to find and delete expired sessions.
- EStore session data in an Amazon DynamoDB table using a partition key based on the user's country code to distribute the load.
Answer
Storing session data in an Amazon DynamoDB table with TTL enabled, or storing session data in an Amazon ElastiCache for Redis replication group with Multi-AZ and key expiration.
The correct options are storing session data in Amazon DynamoDB with TTL enabled, and using Amazon ElastiCache for Redis with Multi-AZ and key expiration. DynamoDB natively replicates data across multiple Availability Zones, supports low-latency writes, and automatically deletes expired items based on a TTL attribute without consuming read/write capacity. Amazon ElastiCache for Redis supports high-availability replication across Availability Zones, sub-millisecond latency, and native key expiration.
Step-by-Step Solution
Key Concept
Implementing distributed session stores with automatic expiration using Amazon DynamoDB TTL and Amazon ElastiCache for Redis.