Courseiva

DOP-C02 Configuration Management and IaC Practice Question

A company uses AWS CodeBuild to run unit tests and package a Java application. The build environment needs to have a specific version of Java installed that is not available in the standard build images. The team wants to minimize build time. How should the engineer configure the build environment?

⚠ Common exam trap

A common mix-up: candidates think installing software during the build (options B or D) is acceptable, but the question explicitly requires minimizing build time, making a pre-built custom image the only optimal choice.

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

✓

Use a custom build image that already includes the required Java version, stored in Amazon ECR.

Using a custom build image stored in Amazon ECR allows the team to pre-install the exact Java version required, eliminating the need for runtime installation. This minimizes build time by avoiding the overhead of downloading and installing software during every build, while still providing a consistent, reproducible environment.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Use AWS Lambda to run the tests and package the application.

    Why it's wrong here

    AWS Lambda enforces a 15-minute execution timeout and a maximum of 10GB ephemeral storage, and it is designed for short, event-driven functions rather than CI/CD build workloads. It does not ship a Java build toolchain, and trying to run unit tests plus packaging inside a Lambda invocation would require custom runtimes and would fail once compilation or dependency resolution exceeds the timeout.

  • ✗

    Use a standard build image and include a pre-build command to install the required Java version.

    Why it's wrong here

    Although a standard CodeBuild image can be updated with a pre-build command to install the required JDK, that installation runs on every build because each build starts a fresh, ephemeral container. Downloading and installing the JDK via a package manager adds minutes to each build, directly increasing CodeBuild's per-minute cost, and the command may pull a different minor version over time, leading to non-reproducible builds unless you pin the exact package.

  • ✓

    Use a custom build image that already includes the required Java version, stored in Amazon ECR.

    Why this is correct

    A custom build image with the required Java version already installed, stored in Amazon ECR, is the correct architecture because CodeBuild can be configured to pull that image at build time. Baking the JDK, build tool, and dependency caches into Docker layers means the runtime is available immediately, eliminating per-build installation overhead and making versioning deterministic. This approach is the intended pattern for non-standard language versions.

  • ✗

    Use the pre-build phase to download and install Java from an S3 bucket.

    Why it's wrong here

    Downloading a JDK from an S3 bucket in the pre-build phase still performs the installation work on every build, just from a different source. You must also manually configure JAVA_HOME and PATH, and the S3 download introduces network latency and a potential external dependency during the build. This repeats the same fundamental overhead as installing via a package manager, with extra manual maintenance and a longer pre-build phase.

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.