Courseiva
Development with AWS ServiceseasyMultiple ChoiceObjective-mapped

DVA-C02 Development with AWS Services Practice Question

A company is using AWS CodePipeline to automate deployments. The pipeline has a source stage that retrieves code from Amazon S3, a build stage using AWS CodeBuild, and a deploy stage using AWS CodeDeploy. The build stage is failing intermittently with errors related to missing dependencies. What should a developer do to ensure the build environment has all required dependencies?

⚠ Common exam trap

It's easy for candidates to think environment variables (Option A) can solve dependency issues, but they confuse configuration with actual installation, or they assume changing the source repository (Option C) will somehow fix build failures, when the real solution lies in defining the build process within the source code itself.

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

Create a custom buildspec.yml file in the source code that installs the dependencies in the install phase.

The buildspec.yml file defines the build phases for AWS CodeBuild, including the install phase where you can specify commands to install dependencies (e.g., using package managers like pip, npm, or apt-get). By placing this file in the source code, the build environment automatically executes these commands on every build, ensuring all required dependencies are present and consistent across runs, which resolves intermittent failures caused by missing dependencies.

Answer analysis

Option-by-option breakdown

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

  • Configure environment variables in CodePipeline to set dependency paths.

    Why it's wrong here

    Configuring environment variables directly in CodePipeline primarily affects the pipeline's orchestration logic or specific action configurations, not the runtime environment of the CodeBuild container itself. CodePipeline does not natively inject these variables into the CodeBuild build environment for dependency resolution. CodeBuild relies on its `buildspec.yml` or project-level environment settings to define variables accessible during the build process, making this approach ineffective for installing dependencies.

  • Manually install dependencies on the CodeBuild build server each time.

    Why it's wrong here

    Manually installing dependencies on the CodeBuild build server each time fundamentally contradicts the principles of automation and continuous integration/delivery (CI/CD). CodeBuild environments are often ephemeral, meaning any manual changes would be lost between builds, leading to inconsistent and non-reproducible results. This approach is highly error-prone, significantly increases operational overhead, and defeats the purpose of using an automated pipeline like CodePipeline.

  • Use AWS CodeCommit as the source repository instead of S3.

    Why it's wrong here

    Using AWS CodeCommit as the source repository instead of S3 only changes the location from which the source code is retrieved by CodePipeline and subsequently by CodeBuild. While CodeCommit is a robust version control system, the choice of source repository has no direct impact on how application-specific dependencies (e.g., libraries, packages) are installed or managed during the build phase. The mechanism for dependency resolution remains a function of the build tool and its configuration within the build environment.

  • Create a custom buildspec.yml file in the source code that installs the dependencies in the install phase.

    Why this is correct

    Creating a custom `buildspec.yml` file in the source code is the standard and most effective method for automating dependency installation within AWS CodeBuild. By defining commands in the `install` phase of the `buildspec.yml` (e.g., `npm install`, `pip install`), CodeBuild automatically executes these steps every time the project is built. This ensures that all necessary dependencies are consistently fetched and installed, making the build process reproducible, reliable, and fully integrated with the source code version control.

Visual reference

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

Quick reference

AWS S3 Storage Class Comparison

Storage ClassMin DurationRetrievalUse Case
S3 StandardNoneImmediateFrequently accessed data
S3 Standard-IA30 daysImmediateInfrequent access, rapid retrieval
S3 One Zone-IA30 daysImmediateNon-critical infrequent data
S3 Intelligent-TieringNoneImmediate–hoursUnknown or changing access patterns
S3 Glacier Instant90 daysMillisecondsArchive with instant retrieval
S3 Glacier Flexible90 daysMinutes–hoursArchive, flexible retrieval
S3 Glacier Deep Archive180 daysHoursLong-term compliance archive

About these practice questions

One of 724 original DVA-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 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.