An application stores session data in each EC2 instance's memory. Users lose their sessions when the Auto Scaling group removes instances. Which change BEST preserves sessions as instances scale in and out?
Show the answer
Correct answerD. Store sessions in a shared Amazon ElastiCache cache.
AWhy not this: Sticky sessions maintain routing affinity but cannot preserve memory on a terminated instance.
BWhy not this: A higher minimum capacity does not preserve session data when individual instances are removed.
CWhy not this: CloudFront caches responses at edge locations; it does not provide a shared application session store.
DWhy this is right: A shared cache keeps session data accessible independently of which application instance handles a request.
A shared ElastiCache cache decouples session data from individual instances, allowing replacement instances to retrieve existing sessions. Sticky sessions route users to an instance but do not preserve its in-memory data when it terminates.