AWS Certified Developer – Associate (DVA-C02)DeploymentMedium
A developer is configuring an AWS CodeBuild project for a large application. The build process involves downloading many external dependencies that rarely change, which significantly increases build times. The team wants to optimize build performance by caching these dependencies. The CodeBuild project is used by multiple pipelines, and the cache needs to be persistent and accessible across different build runs and projects. Which caching mechanism should be implemented?
- ADocker layer caching within the build environment.
- BLocal caching using CodeBuild's local cache.
- CAWS Systems Manager Parameter Store to store dependency paths.
- DAmazon S3 caching using a dedicated S3 bucket.
Show answer & explanationAnswer & explanation
Correct answer: D. Amazon S3 caching using a dedicated S3 bucket.
Amazon S3 caching is the recommended approach for persistent caching across multiple CodeBuild projects and build runs. It allows CodeBuild to store and retrieve dependencies in an S3 bucket, making them available for subsequent builds, significantly reducing download times for unchanging dependencies. Local caching is instance-specific and non-persistent, while Docker layer caching is for Docker images, not general dependencies.
Why the other options are wrong
- A. Docker layer caching is used to optimize Docker image builds by reusing layers, but it's not for caching general application dependencies downloaded by the build process itself.
- B. Local caching is instance-specific and non-persistent across different build instances or projects.
- C. Parameter Store is for storing configuration data and secrets, not for caching large build artifacts or dependencies.
CodeBuild S3 Caching
A CodeBuild caching mechanism that stores build dependencies and artifacts in an Amazon S3 bucket, allowing for persistent caching across multiple build runs and projects.
- Persistent caching solution.
- Accessible across different CodeBuild projects.
- Reduces build times by reusing downloaded dependencies.
- Configured in the buildspec.yml file.
Memory trick: S3's cache, for builds in a dash.