An online retailer builds its checkout service into a container image with an AWS CodeBuild project that runs on every merge to main.
Each build takes about 14 minutes, because it downloads the same Node.js and Python dependencies from the internet every time and then compiles them again. The build must also reach a private package mirror that exists only inside the company's VPC.
The team wants to keep the existing project and buildspec file, and it does not want to run any build servers of its own.
Which TWO changes meet these requirements? (Choose two.)
Choose two answers.
AA. Increase the project's compute type to the largest size available, so that dependency downloads and compilation finish faster on every build.
BB. Add a cache section to the buildspec that stores the dependency directories in an Amazon S3 cache, so later builds restore packages from the cache instead of downloading them again.
CC. Move the builds onto a fleet of self-managed EC2 instances in an Auto Scaling group that runs a build agent and keeps its own package caches warm between jobs.
DD. Change the base image reference from a specific version tag to latest, so that each build pulls the newest base layers and the dependency downloads shrink.
EE. Attach the existing CodeBuild project to private subnets in the company's VPC, with a security group that allows outbound traffic to the internal package mirror.
Show the answer and explanation
Answers: B, E
A. Wrong: A larger compute type adds cost to every build but leaves the network downloads and repeated compilation in place. The time saved is small and the mirror access problem remains.
B. Right: Correct. CodeBuild can save and restore selected directories through an S3 cache, so most builds skip repeated downloads with only a buildspec change. The project and buildspec file stay in place, and no build servers are added. Learn more: Cache builds to improve performance (opens in a new tab)
C. Wrong: This can be fast, but it replaces the CodeBuild project and adds instances to patch and scale. The team asked to avoid running its own build servers.
CodeBuild can restore cached dependency directories from S3, which removes repeated downloads from the build path. Running the project inside the VPC lets it reach a private mirror without a public route. Larger compute, self-managed build fleets and unpinned base images either leave the slow path in place or add servers and unpredictability.
Want more on Builds with CodeBuild and buildspec? The 5 full-length practice sets have 6 more Builds with CodeBuild and buildspec questions, 375 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets →