A developer is designing a web application that will be hosted on Amazon ECS. The application requires a shared session state store to support horizontal scaling of container instances. The session data consists of semi-structured JSON documents that are updated frequently with each user request. The session documents must automatically expire and be deleted after 24 hours of inactivity to keep storage costs low. Which solution meets these requirements with the lowest operational overhead?
- Store the session data in an Amazon DynamoDB table, and enable DynamoDB Time to Live (TTL) on an attribute containing the expiration timestamp.Cevap
- BStore the session data in an Amazon DynamoDB table, and create a scheduled AWS Lambda function that performs a Scan operation daily to delete expired session records.
- CStore the session data in AWS Systems Manager Parameter Store, using a hierarchical path structure like /sessions/{session_id} to retrieve and update session JSON values.
- DStore the session data in an Amazon DynamoDB table using a single static partition key value to simplify retrieval, and scale up the provisioned Write Capacity Units (WCUs) during peak hours.
Cevap
Store the session data in an Amazon DynamoDB table, and enable DynamoDB Time to Live (TTL) on an attribute containing the expiration timestamp.
Storing session data in Amazon DynamoDB and enabling Time to Live (TTL) provides a fully managed, highly scalable solution. DynamoDB automatically deletes expired items based on a timestamp attribute without consuming provisioned throughput or requiring custom application logic.
Adım Adım Çözüm
Anahtar Kavram
Session State Management using Amazon DynamoDB and Time to Live (TTL)