Courseiva
Development with AWS ServicesmediumMultiple ChoiceObjective-mapped

DVA-C02 Development with AWS Services Practice Question

A developer is running a web application on multiple Amazon EC2 instances behind an Application Load Balancer (ALB). The application needs to store user session state that must be available across all instances. The session data is small and temporary but must survive individual instance failures. Which AWS service should the developer use to store this session state?

⚠ Common exam trap

A common mix-up: candidates confuse 'survive instance failures' with 'persistent storage' and choose S3 or SQS, overlooking that session state requires low-latency, in-memory access with automatic expiry, which only ElastiCache provides among the options.

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 cluster

Amazon ElastiCache (e.g., using Redis or Memcached) provides a centralized, in-memory data store that is external to the EC2 instances. This allows all instances behind the ALB to read and write the same session state, ensuring consistency across the fleet. Because the data is stored in a managed cluster, it survives individual instance failures and is ideal for small, temporary session data that requires low-latency access.

Answer analysis

Option-by-option breakdown

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

  • Store session state in an Amazon ElastiCache cluster

    Why this is correct

    Amazon ElastiCache provides a fully managed, in-memory caching service, making it an excellent choice for storing web application session state. By centralizing session data in an ElastiCache Redis or Memcached cluster, all EC2 instances can access and update the same session information, ensuring session stickiness and persistence even if a user's subsequent request is routed to a different instance. Its low-latency access and high availability features, including replication and automatic failover, are critical for responsive and resilient user experiences in distributed environments.

  • Store session state in the /tmp directory of each EC2 instance

    Why it's wrong here

    Storing session state in the /tmp directory of an EC2 instance is fundamentally unsuitable for a multi-instance web application. This directory is local and ephemeral; its contents are lost upon instance termination, reboot, or even sometimes during system cleanup. Crucially, session data stored here cannot be shared across other EC2 instances, meaning a user's session would break if their next request is routed to a different server by the load balancer, leading to a poor user experience.

  • Use an Amazon SQS queue to persist session data

    Why it's wrong here

    Amazon SQS is a highly scalable, fully managed message queuing service designed for asynchronous communication between decoupled application components, not for direct, low-latency session state storage. Using SQS for session data would require polling the queue for updates and pushing new messages for every read and write operation, which is an extremely inefficient and high-latency pattern for interactive user sessions. This approach fundamentally misuses a messaging service for a real-time data store requirement.

  • Store session state in an Amazon S3 bucket

    Why it's wrong here

    While Amazon S3 can store data, it is an object storage service optimized for large, static, or infrequently changing objects, not for the high-frequency, low-latency read/write operations typical of session state management. Retrieving and updating small session data objects from S3 on every web request would introduce significant latency compared to in-memory solutions. Furthermore, the high volume of PUT and GET requests required for active sessions could quickly lead to throttling, increased operational complexity, and higher costs due to request charges.

About these practice questions

This DVA-C02 question is part of Courseiva's 724-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 DVA-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 DVA-C02 exam.