SAP-C02 Continuous Improvement for Existing Solutions Practice Question
A company runs a critical Java application on Amazon EC2 instances behind an Application Load Balancer. The application stores session state in local instance memory, and the Auto Scaling group is configured to terminate instances when CPU utilization drops below 20%. During a recent scaling event, users were unexpectedly logged out and lost shopping cart contents. A solutions architect needs to make the application stateless so that instances can be terminated without impacting users, while minimizing changes to the application code. Which solution meets these requirements?
⚠ Common exam trap
The trap here is assuming that sticky sessions or connection draining can preserve session state when an instance is terminated.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Store session state in an Amazon ElastiCache for Redis cluster and update the application to use the ElastiCache endpoint for session data.
The application is stateful because it stores session data in local instance memory. To allow instances to be terminated without user impact, session state must be externalized. ElastiCache for Redis is a fully managed, in-memory store that supports high-performance session management and is a common solution for making Java applications stateless. The other options do not remove the dependency on local instance memory.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Change the Auto Scaling group termination policy to OldestInstance and enable connection draining on the load balancer.
Why it's wrong here
Changing the termination policy affects which instances are terminated first, but it does not preserve session state. Connection draining allows in-flight requests to complete, but once the instance is terminated, any session data stored locally is lost. This does not address the root cause of user logouts and cart loss during scaling events.
- ✓
Store session state in an Amazon ElastiCache for Redis cluster and update the application to use the ElastiCache endpoint for session data.
Why this is correct
ElastiCache for Redis provides a highly available, in-memory data store that is external to the EC2 instances. By moving session state to Redis, the application no longer relies on local instance memory, so any instance can be terminated without losing session data. This is the standard approach to make a stateful Java application stateless with minimal code changes, as only the session management layer needs updating.
- ✗
Enable sticky sessions on the Application Load Balancer and increase the deregistration delay to 300 seconds.
Why it's wrong here
Sticky sessions bind a user to a specific instance, but when that instance is terminated during scaling, the session is still lost. Increasing the deregistration delay only postpones connection draining; it does not preserve session state across instance termination. This approach does not make the application stateless and fails to prevent user logouts and cart loss.
- ✗
Configure the Auto Scaling group to use a lifecycle hook that backs up session data to Amazon S3 before termination, and restore it on new instances.
Why it's wrong here
Lifecycle hooks can pause termination to perform actions, but backing up session data to S3 and restoring it on new instances introduces significant latency and complexity. The application would still rely on local memory for active sessions, and new instances would not have the session data unless restored, which is not seamless. This does not achieve statelessness or minimize code changes.
Go deeper
Related to this question
About these practice questions
Courseiva writes every SAP-C02 question from scratch — 984 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Amazon Web Services exam blueprint
This SAP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SAP-C02 exam.