AWS Certified Developer – Associate (DVA-C02)DeploymentMedium

A developer is configuring an AWS CodeBuild project for a large application that has many dependencies. The build times are consistently long due to repeated downloading and installation of these dependencies in every build. The developer wants to optimize build times by caching these dependencies. Which CodeBuild feature should they implement to achieve this?

  1. AConfigure an S3 cache in the CodeBuild project settings.
  2. BEnable local caching for the CodeBuild project.
  3. CPre-install dependencies in the Docker image used by CodeBuild.
  4. DUse a larger CodeBuild compute type (e.g., `BUILD_GENERAL1_LARGE`).
Show answer & explanation

Correct answer: A. Configure an S3 cache in the CodeBuild project settings.

Configuring an S3 cache in CodeBuild allows you to store and reuse build artifacts and dependencies across multiple builds. This significantly reduces build times by preventing repeated downloads and installations, especially for large dependency sets.

Why the other options are wrong

  • B. Local caching is available but is less effective for reducing build times across *multiple, distinct* builds, as it's tied to a single build instance that might not be reused.
  • C. Pre-installing dependencies in the Docker image is a good practice for base images but might not be flexible enough for frequently changing dependencies or for caching intermediate build artifacts.
  • D. While a larger compute type might speed up processing, it doesn't address the root cause of repeated dependency downloads, which is the primary bottleneck for 'long build times due to repeated downloading and installation'.

CodeBuild S3 Caching

A CodeBuild feature that stores build dependencies and artifacts in an Amazon S3 bucket, allowing them to be reused across subsequent builds to significantly reduce build times by avoiding repeated downloads and installations.

  • Stores artifacts in S3.
  • Reuses dependencies across builds.
  • Reduces build times significantly.

Memory trick: FASTER-BUILD: Find A Solution To Every Repetitive Build, Use Intelligent Caching.

More Deployment questions