Courseiva
SDLC Automation →mediumMultiple Choice

DOP-C02 SDLC Automation Practice Question

An organization uses AWS CodeDeploy to deploy applications to Amazon EC2 instances. The deployment is failing consistently with the error 'ScriptMissing' for the AppSpec lifecycle hook 'ApplicationStop'. The scripts are located in the /opt/scripts directory on the instances. What is the most likely cause of this error?

⚠ Common exam trap

Candidates often confuse 'ScriptMissing' with permission errors or agent issues, but AWS specifically uses 'ScriptMissing' to indicate the file path is incorrect or the file is absent, not that the file exists but cannot be executed.

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

✓

The AppSpec file specifies a path to the script that does not exist on the instance.

The 'ScriptMissing' error in AWS CodeDeploy indicates that the deployment lifecycle hook (in this case, 'ApplicationStop') cannot find the script file at the path specified in the AppSpec file. Since the scripts are located in /opt/scripts, the most likely cause is that the AppSpec file's 'location' field for the ApplicationStop hook points to a path that does not match the actual file location on the instance, or the script file itself is missing from that directory.

Answer analysis

Option-by-option breakdown

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

  • ✗

    The ApplicationStop hook is not defined in the AppSpec file.

    Why it's wrong here

    If the ApplicationStop hook were not defined, CodeDeploy would simply skip that lifecycle event and never attempt to run a script, so the agent could not raise a ScriptMissing error for ApplicationStop. ScriptMissing is only emitted when the agent tries to execute the hook script and the referenced file is absent. Thus, the hook definition exists, but its script path points to a file that isn't on the instance.

  • ✗

    The CodeDeploy agent is not the latest version.

    Why it's wrong here

    The CodeDeploy agent version determines which features and bug fixes are available, but it does not influence whether a file exists at a given path on the instance filesystem. ScriptMissing is an ENOENT condition reported by the agent when it invokes the script path from the AppSpec, regardless of whether the agent is current or outdated. Upgrading the agent would not alter the file system layout or make a missing script appear.

  • ✓

    The AppSpec file specifies a path to the script that does not exist on the instance.

    Why this is correct

    The AppSpec hooks section contains a location field that must point to a script actually present in the extracted application revision. During a lifecycle event, the agent resolves that path against the deployment archive's directory structure; if the file is not there—perhaps due to a typo, an absolute path instead of a relative one, or omitted from the bundle—the operating system returns ENOENT and CodeDeploy reports ScriptMissing. Fixing the AppSpec path to match the bundled script resolves the deployment.

  • ✗

    The scripts have incorrect file permissions.

    Why it's wrong here

    Incorrect file permissions would not produce ScriptMissing. If a script exists but lacks the execute bit, CodeDeploy reports ScriptNotExecutable; if the script exists but the runtime user lacks read permission, the OS raises Permission denied and the deployment fails with a ScriptFailed error. ScriptMissing specifically means the file was not found at the configured path, which is a different failure stage—before execution and permission checks even occur.

About these practice questions

Courseiva writes every DOP-C02 question from scratch — 1,298 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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.