Courseiva
Question 52 of 256
SDLC AutomationmediumMultiple ChoiceObjective-mapped

DOP-C02 SDLC Automation Practice Question

A company is using AWS CodeDeploy to deploy a web application to an Auto Scaling group. The deployment fails with the error 'The overall deployment failed because too many individual instances failed deployment, too few healthy instances are available, or some instances in your deployment group are experiencing problems.' The deployment configuration uses a linear traffic shifting with a 10-minute interval. The application logs show that the new version of the application crashes on startup. What is the MOST effective way to handle this situation to ensure successful future deployments?

⚠ Common exam trap

It's easy for candidates to confuse recovery mechanisms (like rollback or blue/green) with prevention mechanisms, failing to realize that the most effective solution is to catch the failure early using the ValidateService lifecycle hook, which directly validates application health before traffic is shifted.

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

Add a script in the AppSpec file's 'Validate Service' lifecycle hook to check the application health and fail the deployment if the application does not start successfully.

The 'Validate Service' lifecycle hook in the AppSpec file runs after the application is installed and started, allowing you to execute a custom script that verifies the application is healthy. If the script detects that the new version crashes on startup, it can return a non-zero exit code, which causes CodeDeploy to mark that instance as failed and trigger the deployment failure. This provides an early, automated validation that prevents the deployment from proceeding with a broken application, directly addressing the root cause of the crash.

Answer analysis

Option-by-option breakdown

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

  • Increase the interval in the linear traffic shifting to 30 minutes to allow more time for instances to stabilize.

    Why it's wrong here

    Increasing the linear traffic shifting interval to 30 minutes does not address the underlying startup crash; it merely stretches the time-based increments over which traffic moves. If the newly deployed application fails to launch, instances are still unhealthy after the interval, and shifting traffic to them will eventually cause errors or an automatic rollback. The interval is a timing control, not a health check or remediation mechanism.

  • Configure the deployment to automatically roll back when a failure occurs and ignore the error.

    Why it's wrong here

    Configuring automatic rollback on failure only reverts to the last known good revision after the new version crashes, so the underlying defect in the application code or configuration remains untouched. 'Ignore the error' is also dangerous because CodeDeploy will report a successful deployment even though the app is failing, violating your deployment validation requirements. A future deployment will encounter the identical startup failure, since nothing was corrected.

  • Switch to a blue/green deployment strategy to minimize the impact on existing instances.

    Why it's wrong here

    Switching to a blue/green deployment does not eliminate the requirement that the new application actually start and pass health checks in the green environment. The newly launched replacement instances will crash on startup just as the original ones did, fail Elastic Load Balancing health check registration, and cause the deployment to abort or roll back. The strategy changes how traffic is cut over, but cannot compensate for a faulty application build or startup sequence.

  • Add a script in the AppSpec file's 'Validate Service' lifecycle hook to check the application health and fail the deployment if the application does not start successfully.

    Why this is correct

    Adding a script to the ValidateService lifecycle hook is the correct solution because this hook executes after ApplicationStart and is designed to verify application readiness. When the script detects that the application did not start successfully—for example, it curls a local endpoint or checks the listening port—it returns a nonzero exit code, causing CodeDeploy to fail the deployment immediately. This check ensures unhealthy instances are identified before any production traffic is shifted, preventing user-facing outages and allowing you to fix the root cause.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jul 4, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.