DOP-C02 SDLC Automation Practice Question
A company uses AWS CodeBuild to compile a Java application. The build specification includes a pre-build phase to download dependencies. Which file defines the commands for each build phase?
⚠ Common exam trap
It's easy for candidates to confuse the build specification file for CodeBuild (buildspec.yml) with the deployment specification file for CodeDeploy (appspec.yml), especially since both services are part of the AWS CI/CD pipeline and have similar naming patterns.
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
✓
buildspec.yml
In AWS CodeBuild, the build specification file named 'buildspec.yml' defines the commands that CodeBuild runs during each phase of the build process, including the pre-build phase for downloading dependencies. This YAML file is placed in the root of the source code or specified in the build project configuration, and it contains structured sections for install, pre_build, build, and post_build phases. Option B is correct because buildspec.yml is the standard file that CodeBuild uses to orchestrate build commands.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
pipeline.json
Why it's wrong here
pipeline.json is not a recognized configuration file for AWS CodeBuild. While AWS CodePipeline can import or export a JSON-based pipeline structure via the CLI or SDK, that JSON represents the pipeline definition (stages, actions, and transitions), not the build commands CodeBuild executes. CodeBuild specifically searches for buildspec.yml (or a file path defined in the build project's `buildspec` override) to determine the build phases and commands. Therefore, pipeline.json would be ignored and cannot control how the Java application is compiled.
- ✓
buildspec.yml
Why this is correct
buildspec.yml is the correct file because AWS CodeBuild automatically looks for a file named buildspec.yml in the root of the source code directory, unless an alternate buildspec file is specified in the build project. This YAML file defines the build phases—install, pre_build, build, and post_build—along with environment variables, artifact output, and cache settings. For a Java application, the `build` phase would contain commands such as `mvn compile` or `gradle build` to compile the source code. Without a valid buildspec, CodeBuild will fail unless an inline buildspec is provided in the project configuration.
- ✗
config.xml
Why it's wrong here
config.xml is not a configuration file used by AWS CodeBuild. The name config.xml is commonly associated with Jenkins jobs, where it stores the job's build configuration, but AWS CodeBuild has no such file dependency. CodeBuild uses buildspec.yml for build instructions, and project-level settings (like compute type, environment image, and service role) are managed separately within the AWS CodeBuild console or API. Therefore, placing a config.xml in the source bundle would have no effect on the build process.
- ✗
appspec.yml
Why it's wrong here
appspec.yml is the configuration file used by AWS CodeDeploy, not AWS CodeBuild. It defines deployment lifecycle hooks, file mappings, and permissions for deploying an application to EC2, Lambda, or ECS instances. CodeBuild, on the other hand, uses buildspec.yml to compile and package the application during the build phase. For a Java application being compiled, CodeBuild would look for buildspec.yml, so appspec.yml is an incorrect choice; it is only relevant after the build artifact is handed off to CodeDeploy for deployment.
Go deeper
Related to this question
About these practice questions
One of 1,298 original DOP-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 →
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.