Courseiva
SDLC Automation →hardMultiple Choice

DOP-C02 SDLC Automation Practice Question

A DevOps engineer is troubleshooting a slow AWS CodeBuild project. The build is a Java application that compiles source code and runs tests. The build environment uses a general1.large compute type. The build duration has increased from 5 minutes to 15 minutes over the past month. The engineer notices that the build logs show 'Downloading...' messages for Maven dependencies for several minutes. What is the most cost-effective way to reduce the build time?

⚠ Common exam trap

Watch out — candidates often assume upgrading compute resources (Option C) or adding network components (Option A) will fix performance issues, when the actual bottleneck is repetitive network downloads that can be eliminated with caching.

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

✓

Enable local caching in the CodeBuild project for dependencies

Enabling local caching in AWS CodeBuild allows the build environment to cache Maven dependencies in the local file system across builds. This eliminates the need to re-download dependencies from remote repositories each time, directly addressing the 'Downloading...' messages in the logs. It is the most cost-effective solution as it requires no additional AWS services or compute upgrades.

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 the build to use a VPC with a NAT gateway

    Why it's wrong here

    Adding the build to a VPC and routing traffic through a NAT gateway only changes the network path for outbound requests; it neither stores nor reuses Maven artifacts between executions. Each build still performs a cold download from the external repository, and the VPC/NAT overhead (NAT processing, subnet routing, IAM roles) can even increase build latency. The bottleneck here is dependency re-downloading, not network reachability, so a NAT gateway does not address the root cause.

  • ✗

    Use AWS CodeArtifact as a proxy for Maven dependencies

    Why it's wrong here

    CodeArtifact as an upstream proxy does cache packages on its own infrastructure, but that cache is remote: every CodeBuild run must still pull the dependencies over the network into the ephemeral build container, so it does not eliminate the download step or the associated network time. For Maven specifically, the local build client likely must resolve and fetch coordinates through CodeArtifact endpoints each time, and if the cache hasn't already been populated by a prior run, it still contacts the upstream repository. While CodeArtifact can reduce repeated public repository traffic, enabling local disk caching is the more direct way to avoid re-fetching dependencies on every PR build.

  • ✗

    Change the compute type to general1.2xlarge

    Why it's wrong here

    Changing the CodeBuild compute type to general1.2xlarge increases the vCPU and memory allocation, which helps CPU- or memory-bound build phases such as compilation and test execution. However, when the reported slowness comes from downloading dependencies, the limiting factor is network bandwidth and the round-trip latency of remote repositories — both of which remain unchanged on a larger instance. You will pay for more compute capacity without addressing the actual bottleneck of repeated dependency downloads.

  • ✓

    Enable local caching in the CodeBuild project for dependencies

    Why this is correct

    Enabling local caching in the CodeBuild project tells the build runner to preserve a cache directory on the build host between executions, and when using Maven you can point it at the local repository (~/.m2) so previously downloaded artifacts are reused instead of fetched again. This directly eliminates the repeated network transfer of third-party dependencies, making PR builds dramatically faster by serving artifacts from local disk. Unlike remote caches or bigger compute, it targets the exact dependency-resolution bottleneck and works for both Maven and other package managers when configured correctly.

About these practice questions

This DOP-C02 question is part of Courseiva's 1,298-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 →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

2 more ways this is tested on DOP-C02

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A company uses AWS CodeBuild to compile and test code. The build takes 30 minutes, but the team wants to reduce build time by caching dependencies. Which approach should be used?

medium
  • A.Remove unnecessary dependencies from the build specification.
  • B.Store dependencies in an S3 bucket and download them before each build.
  • C.Use AWS CodeArtifact to store dependencies and pull them during build.
  • ✓ D.Enable local caching in the build project configuration.

Why D: AWS CodeBuild's local caching feature allows you to cache intermediate build artifacts (such as dependencies) in a local directory on the build instance, which persists across builds for the same build project. This eliminates the need to re-download dependencies from external sources for every build, significantly reducing build time. The cache is stored in a Docker volume or S3 bucket, but the key benefit is that it is automatically managed by CodeBuild without manual download steps.

Variation 2. A developer is using AWS CodeBuild to compile code. The build takes a long time because dependencies are downloaded each time. What can the developer do to reduce build time?

easy
  • A.Split the build into multiple parallel build actions.
  • B.Use multiple build environments to distribute the work.
  • ✓ C.Enable caching in the build project to store dependencies in Amazon S3.
  • D.Use a larger compute type for the build project.

Why C: Enabling caching in AWS CodeBuild allows the build project to store frequently downloaded dependencies (e.g., Maven, npm, pip packages) in an Amazon S3 bucket. On subsequent builds, CodeBuild retrieves the cached dependencies from S3 instead of re-downloading them from the internet, which significantly reduces build time. This is the most direct and efficient solution for the described problem of repeated dependency downloads.

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.