DVA-C02 Development with AWS Services Practice Question
A company runs a stateful web application on EC2 instances behind an Application Load Balancer. The application uses WebSockets for real-time communication. The company wants to use AWS CodeDeploy to deploy updates with minimal downtime. Which deployment configuration should the developer use?
⚠ Common exam trap
Test-takers frequently confuse 'immutable deployment' with a valid CodeDeploy option, but AWS CodeDeploy only supports blue/green and in-place deployments, while immutable deployments are a concept from Elastic Beanstalk or EC2 Auto Scaling with launch template versioning.
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
✓
Blue/green deployment.
Blue/green deployment is correct because it allows the company to deploy a new version of the application on a separate set of EC2 instances (green environment) while the current version continues to serve traffic on the original set (blue environment). Once the green environment is fully tested and healthy, the Application Load Balancer can instantly switch traffic to it, minimizing downtime. This approach is ideal for stateful WebSocket applications because it avoids terminating active connections during the deployment, as the blue environment remains operational until the switch is complete.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Canary deployment.
Why it's wrong here
Canary deployment, while a valid strategy in some contexts, is not the most suitable or straightforward method for updating stateful web applications on EC2 instances without session loss. For EC2, CodeDeploy's canary options typically involve traffic shifting to a small percentage of new instances or updating a small batch of existing instances. This gradual rollout can still disrupt stateful sessions if not meticulously managed with sticky sessions or other complex routing rules, making it less ideal than a full environment swap for preserving existing user state.
- ✗
In-place deployment.
Why it's wrong here
In-place deployment updates the application code directly on the existing EC2 instances. For a stateful web application, this process typically involves stopping the application server, deploying the new code, and restarting the server on each instance. During this period, active user sessions on those specific instances would be terminated, leading to session loss and a poor user experience. Even with rolling updates, where instances are updated in batches, users whose sessions are tied to an instance being updated will experience disruption.
- ✓
Blue/green deployment.
Why this is correct
Blue/green deployment involves creating an entirely new, identical environment (the "green" environment) running the new version of the application alongside the existing "blue" environment. Traffic remains directed to the stable "blue" environment while the "green" environment is thoroughly tested. Once verified, traffic is seamlessly shifted from "blue" to "green" at the load balancer level. This approach ensures zero downtime and preserves existing user sessions on the "blue" environment until the switch is complete, making it ideal for stateful applications.
- ✗
Immutable deployment.
Why it's wrong here
Immutable deployments involve replacing instances with new ones that have the updated application code pre-installed, rather than updating existing instances. While this strategy offers benefits like easier rollback and consistent environments, AWS CodeDeploy for EC2 instances does not natively provide an "immutable" deployment type in the same way Elastic Beanstalk does. CodeDeploy primarily focuses on in-place updates or blue/green traffic shifting between distinct environments for EC2, not the automatic replacement of individual instances with new, pre-baked AMIs as a core deployment strategy.
Go deeper
Related to this question
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 →
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.