DVA-C02 Development with AWS Services Practice Question
A company is running a monolithic application on an EC2 instance. The application currently stores session state in local memory on the instance. The company plans to scale the application horizontally by adding more instances behind a load balancer. What change is required to ensure that session state is preserved across requests?
⚠ Common exam trap
Test-takers frequently choose Option D (RDS) because they think a database is the only reliable external store, overlooking that ElastiCache is purpose-built for high-speed, ephemeral data like session state, while RDS introduces unnecessary latency and overhead for this use case.
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
✓
Use Amazon ElastiCache to store session state externally.
Amazon ElastiCache provides a managed, in-memory caching service (e.g., Redis or Memcached) that can store session state externally. By moving session data out of the EC2 instance's local memory and into a shared, low-latency data store, all instances behind the load balancer can access the same session state, ensuring persistence across requests regardless of which instance handles the request.
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 data in Amazon S3 and retrieve it on each request.
Why it's wrong here
Storing session data in Amazon S3 is unsuitable due to its high latency and object storage model, which is optimized for large, infrequent reads rather than frequent, small key-value lookups. Each session update or retrieval would incur significant network overhead and S3 API call costs, making it inefficient for real-time session management. This approach would severely degrade application performance and user experience.
- ✗
Increase the EC2 instance size to handle more sessions per instance.
Why it's wrong here
Increasing the EC2 instance size, while providing more local resources, does not address the fundamental challenge of sharing session state across multiple instances or ensuring high availability. This vertical scaling approach creates a single point of failure; if the instance fails, all active sessions are lost. It also prevents horizontal scaling, as new instances would not have access to existing session data, thus failing to support a distributed, resilient application architecture.
- ✓
Use Amazon ElastiCache to store session state externally.
Why this is correct
Amazon ElastiCache provides a highly performant, in-memory data store, making it an ideal solution for externalizing session state. By storing session data in ElastiCache (e.g., Redis or Memcached), all EC2 instances can access a centralized, low-latency session store, enabling seamless horizontal scaling and high availability. This approach ensures that user sessions persist even if individual application instances are added, removed, or fail, promoting a truly stateless application design.
- ✗
Use an Amazon RDS database to store session state.
Why it's wrong here
Using an RDS database for session state introduces network latency and additional database load for every request, which undermines the low-latency, stateless session retrieval needed when scaling horizontally behind a load balancer. This option is tempting because RDS is a common centralised store for persistent data, and in scenarios requiring durable, queryable session data across multiple services, it would be the correct choice.
Go deeper
Related to this question
About these practice questions
Courseiva writes every DVA-C02 question from scratch — 724 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 →
Same concept, more angles
1 more way this is tested on DVA-C02
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A company has a Node.js application running on an EC2 instance. The application needs to store session state. The developer wants to ensure high availability and scalability by storing session data externally. Which AWS service is BEST suited for this purpose?
medium- A.Amazon DynamoDB
- B.Amazon S3
- ✓ C.Amazon ElastiCache for Redis
- D.Amazon RDS for MySQL
Why C: Amazon ElastiCache for Redis is the best choice for external session storage because it provides an in-memory data store with sub-millisecond latency, which is critical for session state access in a high-traffic Node.js application. Redis supports data structures like hashes and TTL (time-to-live) for automatic session expiration, and it can be clustered for high availability and scalability, making it ideal for stateless EC2 instances behind a load balancer.
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.