AWS Certified Developer – Associate (DVA-C02) — Question 359
A developer has a continuous integration and continuous delivery (CI/CD) pipeline that uses AWS CodeArtifact and AWS CodeBuild. The build artifacts are between 0.5 GB and 1.5 GB in size. The builds happen frequently and retrieve many dependencies from CodeArtifact each time.
The builds have been slow because of the time it takes to transfer dependencies. The developer needs to improve build performance by reducing the number of dependencies that are retrieved for each build.
Which solution will meet this requirement?
Answer options
- A. Specify an Amazon S3 cache in CodeBuild. Add the S3 cache folder path to the buildspec.yaml file for the build project.
- B. Specify a local cache in CodeBuild. Add the CodeArtifact repository name to the buildspec.yaml file for the build project.
- C. Specify a local cache in CodeBuild. Add the cache folder path to the buildspec.yaml file for the build project.
- D. Retrieve the buildspec.yaml file directly from CodeArtifact. Add the CodeArtifact repository name to the buildspec.yaml file for the build project.
Correct answer: C
Explanation
Using a local cache in AWS CodeBuild is the most effective way to speed up builds because it stores dependencies locally on the build host, avoiding the network overhead of fetching them from CodeArtifact or Amazon S3. To configure this, the developer must enable local caching in the CodeBuild project settings and specify the target cache directory paths under the cache section of the buildspec.yaml file. Option A is less optimal because S3 caching still incurs network latency, while Options B and D incorrectly reference configuring the CodeArtifact repository name in buildspec.yaml for caching purposes.