Courseiva

SAP-C02 Continuous Improvement for Existing Solutions Practice Question

A company is running a stateful web application on EC2 instances in an Auto Scaling group. Users report that their sessions are lost when instances are terminated during scale-in. What should a solutions architect do to preserve session state?

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 Amazon ElastiCache.

ElastiCache provides a centralized, fast session store that persists across instance terminations, ensuring session state is retained even when instances are scaled in. Option A is wrong because using lifecycle hooks to save session data to Amazon S3 is unreliable due to the high latency and the risk that the termination process may not complete the save in time. Option B is wrong because sticky sessions (session affinity) on the Application Load Balancer can cause uneven load distribution and still result in session loss if all instances in a target group are replaced or if the specific instance with the session is terminated. Option D is wrong because increasing the Auto Scaling group's cooldown period only delays the next scaling activity but does not preserve session state when instances are eventually terminated.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Use lifecycle hooks to save session data to Amazon S3 before instance termination.

    Why it's wrong here

    Lifecycle hooks fire on termination and cannot persist sessions for requests already in flight, so users still lose state during scale-in. They suit graceful draining, deregistration or cleanup tasks, not continuous session storage that must survive instance replacement.

  • ✗

    Enable sticky sessions (session affinity) on the Application Load Balancer.

    Why it's wrong here

    Session affinity pins a client to one instance, so terminating that instance still destroys the session; it cannot preserve state across scale-in. Sticky sessions suit short-lived state or caching on stable fleets, not sessions that must survive instance termination.

  • ✓

    Store session state in Amazon ElastiCache.

    Why this is correct

    ElastiCache externalises session data from instance memory into a shared Redis or Memcached tier, so any instance in the Auto Scaling group can serve subsequent requests. Scale-in termination no longer discards sessions, satisfying the requirement to preserve state.

  • ✗

    Increase the Auto Scaling group's cooldown period to prevent rapid scaling.

    Why it's wrong here

    Cooldown merely delays subsequent scaling activities; it does not stop the terminating instance from discarding its in-memory sessions. Cooldown periods suit smoothing flapping metrics and avoiding thrashing, not preserving state that must outlive any individual instance.

Quick reference

AWS S3 Storage Class Comparison

Storage ClassMin DurationRetrievalUse Case
S3 StandardNoneImmediateFrequently accessed data
S3 Standard-IA30 daysImmediateInfrequent access, rapid retrieval
S3 One Zone-IA30 daysImmediateNon-critical infrequent data
S3 Intelligent-TieringNoneImmediate–hoursUnknown or changing access patterns
S3 Glacier Instant90 daysMillisecondsArchive with instant retrieval
S3 Glacier Flexible90 daysMinutes–hoursArchive, flexible retrieval
S3 Glacier Deep Archive180 daysHoursLong-term compliance archive

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 →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

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.