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 process frequently downloads the same dependencies from external repositories, leading to long build times. The developer wants to optimize build times by reusing previously downloaded dependencies. Which CodeBuild feature should be used to achieve this efficiently?

  1. AUse a custom Docker image for CodeBuild with pre-installed dependencies.
  2. BIncrease the compute capacity of the CodeBuild project.
  3. CConfigure CodeBuild caching to an Amazon S3 bucket.
  4. DImplement a custom script in the buildspec.yml to download dependencies only if they are missing.
Show answer & explanation

Correct answer: C. Configure CodeBuild caching to an Amazon S3 bucket.

CodeBuild caching to an Amazon S3 bucket is the most effective and managed solution for reusing dependencies. It allows CodeBuild to store and retrieve build artifacts and dependencies, significantly reducing build times for subsequent builds by avoiding redundant downloads.

Why the other options are wrong

  • A. While effective, creating and maintaining a custom Docker image with pre-installed dependencies adds overhead and can become outdated quickly.
  • B. Increasing compute capacity can speed up processing but doesn't address redundant dependency downloads, which is a network bottleneck.
  • D. A custom script is a manual and less robust solution compared to CodeBuild's native caching feature, which is optimized for this exact use case.

CodeBuild S3 Caching

AWS CodeBuild can use an Amazon S3 bucket to cache build artifacts and dependencies, significantly reducing build times by reusing data from previous builds.

  • Reduces build times by avoiding redundant downloads.
  • Supports various caching modes (full, custom).
  • Uses S3 for durable and scalable cache storage.

Memory trick: S3 Cache: Remember past downloads, skip the wait.

More Deployment questions