Courseiva
SDLC Automation →easyMultiple Choice

DOP-C02 SDLC Automation Practice Question

A company uses AWS CodeBuild to run unit tests as part of a CI pipeline. The buildspec.yaml file is located in the root of the source repository. The build takes 30 minutes to complete. The team wants to speed up the build by caching dependencies. Which approach should they take?

⚠ Common exam trap

Candidates may assume any persistent storage (EFS, S3, CodeCommit) will speed up builds, but the question asks for the approach configured in buildspec.yaml. Local caching is the native, buildspec-level caching mechanism for dependencies, though S3 caching is also valid in other contexts.

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

✓

Configure the buildspec.yaml to enable local caching and specify the paths to cache.

CodeBuild supports caching dependencies to speed up builds. The simplest native approach is to enable caching in the buildspec.yaml using the cache configuration, specifying local caching paths (e.g., /root/.m2 for Maven or /root/.cache/pip for pip) so dependencies are preserved between builds on the same build environment. This avoids re-downloading dependencies from the internet each time and can significantly reduce build time. Note that CodeBuild also supports Amazon S3 caching, and EFS can be mounted for shared storage, but local caching is the most direct and commonly recommended option for dependency caching within the buildspec.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Download dependencies from the internet each time the build runs.

    Why it's wrong here

    Downloading dependencies from the internet each build does not speed up the build; it actually increases time.

  • ✗

    Mount an Amazon EFS file system to the build container and store dependencies there.

    Why it's wrong here

    Mounting an EFS file system introduces network latency and is not the most efficient way to cache dependencies for CodeBuild.

  • ✓

    Configure the buildspec.yaml to enable local caching and specify the paths to cache.

    Why this is correct

    Local caching in CodeBuild persists declared dependency directories between builds on the same host, so package managers such as npm or Maven skip re-downloading. Specifying cache paths in buildspec.yaml directly cuts the 30-minute runtime without altering the pipeline structure.

  • ✗

    Store dependencies in an AWS CodeCommit repository and clone it during the build.

    Why it's wrong here

    Storing dependencies in a CodeCommit repository and cloning them each build adds overhead and does not leverage caching.

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 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 →

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.