Courseiva

SAP-C02 Practice Question: Accelerate Workload Migration and Modernization

A company is migrating a legacy PHP application running on a single on-premises server to AWS. The application stores session data locally on the server's filesystem. The company wants to achieve high availability and elasticity for the application on AWS. What should the company do to handle session state in the new architecture?

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 data in Amazon ElastiCache for Redis

Using ElastiCache for session storage decouples session state from individual servers, allowing the application to scale horizontally. Sticky sessions with an ALB ties a user to a specific instance, which reduces availability if that instance fails. Storing sessions on EFS is possible but slower than ElastiCache. Re-architecting to use Cognito is unnecessary for session state.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Configure an Application Load Balancer with sticky sessions enabled

    Why it's wrong here

    Sticky sessions pin each user to one instance, so that instance's local filesystem still holds the state; scaling or failure loses it and breaks elasticity. Tempting because ALB stickiness is a quick fix, and would be correct for short-lived affinity needs, not durable shared session state.

  • ✓

    Store session data in Amazon ElastiCache for Redis

    Why this is correct

    ElastiCache for Redis externalises session state from the instance filesystem into a shared, replicated in-memory store, so any Auto Scaling instance can serve any user's session. This satisfies the elasticity and high availability constraints that local filesystem storage cannot meet.

  • ✗

    Use Amazon EFS to share the session files across multiple EC2 instances

    Why it's wrong here

    Amazon EFS provides a shared POSIX filesystem, but PHP session files written there still carry per-file locking and no native session expiry or replication semantics, and the application remains tied to instances that mount the same file system, so elasticity is constrained. It is tempting because EFS is the standard answer when lifting a legacy application that writes to local disk onto multiple EC2 instances without code changes.

  • ✗

    Refactor the application to use Amazon Cognito for session management

    Why it's wrong here

    Cognito handles authentication and token issuance, not PHP session state storage; it cannot hold arbitrary session variables across instances. Tempting because Cognito is AWS's identity service, and would be correct if the requirement were user sign-in federation rather than shared session persistence.

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

This SAP-C02 question is part of Courseiva's 984-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.