DVA-C02 Deployment Practice Question
A developer is using AWS CodeDeploy to deploy an application to an EC2 instance. The deployment fails with the error 'ScriptMissing' during the BeforeInstall lifecycle event. What is the most likely cause?
⚠ Common exam trap
A common mix-up: candidates confuse 'ScriptMissing' with permission issues or agent connectivity problems, but AWS CodeDeploy has distinct error codes for each failure mode, and 'ScriptMissing' specifically points to a missing file, not execution or agent status.
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 script file specified in the appspec.yml for the BeforeInstall hook is not present on the instance
The 'ScriptMissing' error in AWS CodeDeploy indicates that the deployment failed because a script file referenced in the appspec.yml for a lifecycle event (in this case, BeforeInstall) could not be found on the EC2 instance. CodeDeploy expects the script to be present at the specified path after the archive is extracted; if the file is missing or the path is incorrect, the agent reports this error. Option B correctly identifies that the script file is not present on the instance.
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 BeforeInstall lifecycle event is not defined in the appspec.yml
Why it's wrong here
If the BeforeInstall lifecycle event is not defined in the appspec.yml file, CodeDeploy would simply skip this hook during the deployment process. It would not generate a "ScriptMissing" error; instead, the deployment would proceed directly to the next defined lifecycle event, such as Install. A missing definition does not equate to a missing script file for a *defined* hook, and thus would not produce this specific error.
- ✓
The script file specified in the appspec.yml for the BeforeInstall hook is not present on the instance
Why this is correct
This is the correct explanation. When CodeDeploy executes a deployment, it first downloads the application revision to the instance. If the appspec.yml specifies a script for the BeforeInstall hook, and the CodeDeploy agent cannot locate that script file at the specified path within the downloaded revision on the target instance, it will explicitly fail with a "ScriptMissing" error. This error precisely indicates that the expected script file is physically absent from the instance's file system where the agent is looking.
- ✗
The CodeDeploy agent on the instance is not running
Why it's wrong here
If the CodeDeploy agent is not running on the instance, the AWS CodeDeploy service would be unable to establish communication with that instance to initiate or monitor any deployment steps. This would typically result in errors indicating connection failures, agent health issues, or an inability to reach the target instance, rather than a specific "ScriptMissing" error during a lifecycle event execution. The deployment would likely fail much earlier in the process due to a lack of agent responsiveness.
- ✗
The instance does not have the necessary permissions to execute the script
Why it's wrong here
If the instance lacks the necessary permissions to execute the script specified for the BeforeInstall hook, the CodeDeploy agent would encounter a permission denied error when it attempts to run the script. This error would manifest as an "Access Denied" or similar message, indicating that the file exists but cannot be executed due to incorrect file permissions (e.g., missing executable bit) or user context. This is distinct from the script file being entirely absent from the file system.
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.