Courseiva

SAP-C02 Continuous Improvement for Existing Solutions Practice Question

A company is using AWS CodePipeline to automate deployments of a web application. The pipeline includes a build stage using AWS CodeBuild and a deploy stage using AWS CodeDeploy to an Auto Scaling group. Recently, deployments have been failing during the deploy stage with an error indicating that the target instances are not in a healthy state. The CodeDeploy agent logs show that the agent is running but the application validation scripts are failing. Which THREE actions should the solutions architect take to troubleshoot and resolve the issue?

⚠ Common exam trap

SAP-C02 often tests the misconception that increasing timeouts or adding health checks at the Auto Scaling level will resolve application-level validation failures, when the root cause is typically within the script or its configuration.

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

✓

Test the validation script manually on a healthy instance to confirm it works as expected.

Option A is correct because running the validation script manually on a healthy instance isolates whether the script itself is broken or whether the failure is environmental (permissions, dependencies, or runtime context), which is the fastest way to reproduce and diagnose the error. Option C is correct because the CodeDeploy agent logs on a failing instance (typically /var/log/aws/codedeploy-agent/codedeploy-agent.log) contain the exact stderr/stdout and exit code from the failing lifecycle hook, pinpointing the specific validation error. Option D is correct because CodeDeploy only executes scripts mapped to lifecycle event hooks defined in the AppSpec file's hooks section (for EC2/on-premises, e.g., BeforeInstall, AfterInstall, ApplicationStart, ValidateService); if ValidateService is missing or misspelled, the validation script never runs as intended and the deployment fails validation. Option B is not appropriate because increasing the deployment timeout only masks a script that is failing outright rather than slow, and the logs already show the validation scripts are failing, not timing out. Option E is not appropriate because Auto Scaling lifecycle hooks govern instance launch/termination and do not address CodeDeploy application validation script failures during the deploy stage.

Answer analysis

Option-by-option breakdown

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

  • ✓

    Test the validation script manually on a healthy instance to confirm it works as expected.

    Why this is correct

    Running the validation script manually on a healthy instance isolates whether the script itself is faulty, independent of CodeDeploy orchestration. This directly addresses the stem's constraint that the agent runs but validation scripts fail, confirming whether the script logic or its environment causes the failure.

  • ✗

    Increase the deployment timeout in the CodeDeploy deployment group to allow more time for validation.

    Why it's wrong here

    Extending the deployment timeout only lets failing validation scripts run longer before the deployment aborts; the scripts still fail. It is tempting because timeouts do cause deployment failures, so raising the value is correct when validation legitimately needs more time than the configured window.

  • ✓

    Review the CodeDeploy agent logs on a failing instance to identify the specific error in the validation script.

    Why this is correct

    The CodeDeploy agent logs record the exact exit code and stderr from each lifecycle script. Reviewing them on a failing instance pinpoints the specific validation error, satisfying the stem's need to diagnose why scripts fail despite the agent running.

  • ✓

    Verify that the AppSpec file includes the correct lifecycle event hooks (e.g., ValidateService).

    Why this is correct

    CodeDeploy executes scripts only when the AppSpec file maps them to lifecycle event hooks such as ValidateService. If the hook is missing or misspelled, validation scripts never run correctly, producing the unhealthy-state errors described in the stem.

  • ✗

    Configure an Auto Scaling lifecycle hook to perform health checks before the instance is placed in service.

    Why it's wrong here

    A lifecycle hook delays instance termination or launch; it cannot fix validation scripts failing on already-running, in-service instances. It is tempting because lifecycle hooks genuinely gate instance health during scale-in and scale-out events, which is the right control when instances enter service unhealthy.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

About these practice questions

One of 984 original SAP-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Amazon Web Services exam blueprint

This SAP-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 SAP-C02 exam.