Courseiva

DVA-C02 Development with AWS Services Practice Question

A company uses AWS CodePipeline to deploy a web application to an EC2 instance. The deployment often fails because the application is still running when new files are copied. Which THREE actions can be combined to achieve zero-downtime deployments?

⚠ Common exam trap

Many candidates confuse CodeBuild (a build service) with a deployment tool, or assume Amazon Inspector (a security scanner) can manage deployment workflows, when in fact only CodeDeploy and Auto Scaling groups provide the necessary lifecycle hooks and traffic management for zero-downtime updates.

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 AWS CodeDeploy with an in-place deployment configuration.

AWS CodeDeploy with an in-place deployment configuration can be combined with lifecycle hooks (such as BeforeInstall and AfterInstall) to stop the application before new files are copied and start it afterward, enabling zero-downtime deployments when properly orchestrated with a load balancer to drain traffic. Option B is correct because configuring EC2 instances behind an Auto Scaling group with a rolling update allows new instances to be launched with the updated application while old instances are terminated, ensuring continuous service availability. Option C is correct because defining an AppSpec file with BeforeInstall and AfterInstall hooks provides the mechanism to gracefully stop and start the application, preventing file conflicts and downtime.

Answer analysis

Option-by-option breakdown

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

  • ✓

    Use AWS CodeDeploy with an in-place deployment configuration.

    Why this is correct

    AWS CodeDeploy is purpose-built for orchestrating application deployments to various compute services, including EC2 instances. An in-place deployment configuration updates the application directly on existing instances, leveraging lifecycle hooks to manage the application's state during the update. This ensures the new version is installed correctly and the application's availability is maintained, making it a direct solution for deploying a web application.

  • ✓

    Configure the EC2 instances behind an Auto Scaling group and use a rolling update.

    Why this is correct

    For web applications demanding high availability and minimal downtime, configuring EC2 instances within an Auto Scaling group to perform a rolling update is highly effective. This strategy gradually replaces older instances running the previous application version with new instances provisioned with the updated code. It ensures continuous service availability by maintaining a healthy capacity behind a load balancer throughout the entire deployment process, preventing any service interruption.

  • ✓

    Define an AppSpec file that includes 'BeforeInstall' and 'AfterInstall' hooks to stop and start the application.

    Why this is correct

    The AppSpec file is a critical component of AWS CodeDeploy, defining the deployment actions and lifecycle events. By including 'BeforeInstall' and 'AfterInstall' hooks, developers gain precise control over the application's state during deployment. For instance, the 'BeforeInstall' hook can gracefully stop the web server before new files are copied, and 'AfterInstall' can restart it, ensuring a clean update without application errors or downtime.

  • ✗

    Use AWS CodeBuild to build and deploy the application.

    Why it's wrong here

    AWS CodeBuild is a fully managed continuous integration service designed primarily for compiling source code, running unit tests, and producing deployable artifacts like Docker images or ZIP files. While it's an essential part of a CI/CD pipeline, its core function is building and testing, not orchestrating the actual deployment of an application to target environments such as EC2 instances. CodeDeploy is the dedicated service for deployment orchestration.

  • ✗

    Use Amazon Inspector to check the application before deployment.

    Why it's wrong here

    Amazon Inspector is an automated security assessment service focused on identifying security vulnerabilities and deviations from best practices within applications deployed on AWS. Its primary role is to enhance the security posture of applications by scanning for common vulnerabilities and exposures (CVEs) and configuration issues. It does not provide functionality for managing or executing the deployment process of a web application itself.

About these practice questions

This DVA-C02 question is part of Courseiva's 1,135-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.