A developer is building a real-time collaborative whiteboarding application on AWS. The application requires a fast, external session store to track active users' presence and canvas coordinates. The session store must support advanced data structures (such as hashes and sets), low-latency pub/sub messaging for instant updates, and automatic failover to prevent session loss. Additionally, the developer must ensure that session data is automatically removed after minutes of inactivity.
Which TWO configurations or architectural decisions should the developer implement to meet these requirements? (Select TWO.)
- Deploy an Amazon ElastiCache for Redis replication group with Multi-AZ and automatic failover enabled.Cevap
- Use the Redis EXPIRE command to set a -second Time to Live (TTL) on each session key.Cevap
- CStore session state in AWS Secrets Manager and configure a custom Lambda function to rotate and delete session tokens every minutes.
- DStore session state in a DynamoDB table and configure a cron-scheduled Lambda function to run a Scan operation every minutes to delete stale sessions.
- EWrite session data to a local variable inside a Lambda function's handler to persist the state across subsequent invocations of the same collaborative room.
Cevap
The developer should deploy an Amazon ElastiCache for Redis replication group with Multi-AZ and automatic failover enabled, and use the Redis EXPIRE command to set a -second Time to Live (TTL) on each session key.
Deploying an Amazon ElastiCache for Redis replication group with Multi-AZ and automatic failover provides the necessary support for hashes, sets, and pub/sub messaging along with high availability. Setting a -second TTL using the Redis EXPIRE command ensures that the key is automatically evictable by Redis after minutes of inactivity without requiring any external cleanup processes.
Adım Adım Çözüm
Anahtar Kavram
Selecting and configuring the correct external caching and session state mechanism based on application requirements (such as data structure support, replication, and TTL cleanup).