‹ All DOP-C02 questions

DOP-C02 Practice Question 3: CodeBuild Cache Build Duration

AWS Certified DevOps Engineer – Professional (DOP-C02) · Test 1 · question 3 of 10

SDLC Automationeasy

Builds in an AWS CodeBuild project take roughly 14 minutes, and the build logs show that about 9 of those minutes are spent re-downloading the same third-party dependency packages into a node_modules directory on every run. The project builds many times per day on a fleet of on-demand build hosts, and the team does not want to rewrite the buildspec logic, bake dependencies into a custom build image, or provision dedicated, always-on build infrastructure.

What is the most effective change to shorten build times?

Select one answer
Show answer and explanation

Answer:

  • A. Enable an Amazon S3 cache on the project and list the dependency directory under cache.paths in the buildspec

CodeBuild supports two cache types. An S3 cache stores the directories you name in the buildspec's cache.paths in an S3 bucket and restores them at the start of the next build, regardless of which build host runs. Because the problem is a repeatedly re-downloaded dependency directory and the fleet is on-demand, a different host each time, an S3 cache is exactly the right tool, and it requires only a project setting plus a cache.paths entry rather than any rewrite of the build logic.

Option B treats a network-bound problem as a CPU problem. A larger compute type gives more vCPU and memory; it does not stop the build from fetching the same packages from the internet on every run. It also raises cost per build minute.

Option C targets the wrong artifact. Local Docker layer caching speeds up docker build by reusing image layers, which helps projects that build container images. These builds are populating a node_modules directory in the build workspace, not producing Docker layers. Local caches also live on the build host, so they are unavailable to a fresh on-demand host.

Option D does not fix the problem on its own. Reusing the same reserved-capacity host does not by itself keep node_modules between builds; AWS's fleet guidance still recommends turning on a cache mode to benefit from reuse. It also contradicts the stem: a reserved capacity fleet is dedicated, always-on infrastructure that keeps incurring cost for as long as it is provisioned, whether or not builds are running. The S3 cache solves the stated problem directly and at trivial cost.

References: Build caching in CodeBuild; Run builds on reserved capacity fleets

Practice Test 1 ›

Study guides for DOP-C02

AWS Service Control Policies Explained: SCPs and DenialsAWS service control policies explained: how SCPs cap permissions, why admins still get access denied, inheritance, deny vs allow lists and the exam traps.
How AI Is Changing Software Jobs: Where to PrepareHow AI is changing software jobs: what history shows, the evidence on junior developers, what Klarna learned, new AI roles and five domains to prepare for.
How AWS Certification Exams Work: Scoring and RenewalHow AWS certification exams work: levels, booking, question types, unscored questions, scaled scores, pass marks, validity and how recertification works.
What Is Amazon RDS? Multi-AZ, Read Replicas and BackupsWhat is Amazon RDS? Engines, Multi-AZ, read replicas, backups, RDS Proxy, Aurora and pricing explained, with the traps that AWS exams set around each one.
Best DevOps certification: AWS, Azure, Google or CKAThe best DevOps certification for your stack: AWS DOP-C02, Azure AZ-400, Google Cloud DevOps Engineer and CKA compared on cost, level and prerequisites.
What Is AWS Lambda? Triggers, Concurrency and Cold StartsWhat is AWS Lambda? How functions run, cold starts, triggers vs event source mappings, concurrency, layers, aliases, pricing and the exam traps.
AWS CloudOps Engineer Associate (SOA-C03) exam guideAWS Certified CloudOps Engineer – Associate (SOA-C03) replaced SysOps Administrator. Format, cost, the five domains, what changed and how to prepare.
Which AWS certification should you get? 2026 roadmapWhich AWS certification to get first, by role and experience, with each exam's status in October 2026, what is changing, and prices in USD and INR.
What Is Amazon EC2? Instances, AMIs, EBS and Auto ScalingAmazon EC2 explained: instances, AMIs, instance types, security groups, EBS, Auto Scaling groups and pricing options, with the traps AWS exams set.
SQS vs SNS vs EventBridge on AWSWhen to use an SQS queue, an SNS topic or an EventBridge bus, plus fan-out, FIFO ordering, visibility timeouts and dead-letter queues for AWS exams.