Courseiva
Resilient Cloud SolutionshardMultiple ChoiceObjective-mapped

DOP-C02 Resilient Cloud Solutions Practice Question

A company runs a stateful web application on EC2 instances behind a Network Load Balancer (NLB) in a single Availability Zone. The application stores session state locally on the instance. The company wants to achieve high availability across multiple AZs with minimal application changes. What should the DevOps engineer do?

⚠ Common exam trap

Watch out — candidates often assume cross-zone load balancing or adding more AZs inherently solves high availability for stateful applications, but they overlook that session affinity is required to keep a client's requests directed to the same instance when session state is stored locally.

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

Replace the NLB with an ALB and enable sticky sessions (session affinity) using the ALB's cookie.

Replacing the NLB with an ALB and enabling sticky sessions (session affinity) using the ALB's cookie allows the stateful web application to maintain session state across multiple AZs without modifying the application code. The ALB generates a cookie (AWSALB) that binds a client's session to a specific target instance, ensuring subsequent requests from the same client are routed to the same EC2 instance. This achieves high availability across AZs with minimal changes, as the application continues to store session state locally on the instance.

Answer analysis

Option-by-option breakdown

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

  • Add more AZs and configure the NLB with cross-zone load balancing.

    Why it's wrong here

    Adding more Availability Zones and enabling cross-zone load balancing on the NLB improves distribution and fault tolerance, but it does nothing to preserve session affinity. Because the NLB operates at Layer 4 and has no concept of HTTP cookies, consecutive requests from the same client can be routed to different EC2 instances, causing the local session state to be lost. This option fails to address the core problem of session continuity.

  • Replace the NLB with an ALB and use ElastiCache for session storage.

    Why it's wrong here

    Replacing the NLB with an ALB and offloading session state to ElastiCache would technically provide shared, durable sessions across instances, but it forces the application to be rewritten to read and write session data from an external cache. This is not a minimal infrastructure-only change, and it introduces additional operational complexity and a new dependency that must be managed. Since the question asks for the least disruptive solution, this option is incorrect.

  • Use a Multi-AZ RDS instance to store session state.

    Why it's wrong here

    Using a Multi-AZ RDS instance to store session state requires modifying the application to persist session data in a relational database, which adds significant latency and overhead for high-frequency session read/write operations. This approach not only demands substantial code changes but also couples session lifecycle management to database scalability and cost. Such a solution is neither minimal nor the simplest way to address the existing session affinity problem.

  • Replace the NLB with an ALB and enable sticky sessions (session affinity) using the ALB's cookie.

    Why this is correct

    Replacing the NLB with an ALB and enabling sticky sessions via the ALB's load balancer-generated cookie is the correct minimal-change solution. The ALB inserts a stickiness cookie on the first response, and all subsequent requests from that client are routed to the same EC2 instance, preserving the locally stored session state without any application modifications. This leverages the ALB's Layer 7 capabilities to achieve session affinity while keeping the existing web application code unchanged.

About these practice questions

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