AWS Certified Developer – Associate (DVA-C02)Troubleshooting and MonitoringEasy

A development team is using AWS CodeBuild for their continuous integration pipeline. Recently, builds have started failing with an 'Out of memory' error during the compilation phase, even though the source code size has not significantly increased. The build project is configured with a 'build.general1.small' compute type. What is the MOST efficient solution to resolve this issue?

  1. AChange the compute type of the CodeBuild project to a larger instance, such as 'build.general1.large'.
  2. BOptimize the application's build process to reduce memory consumption during compilation.
  3. CIncrease the 'Timeout' setting for the CodeBuild project to allow more time for compilation.
  4. DConfigure a custom Docker image for CodeBuild with more swap space enabled.
Show answer & explanation

Correct answer: A. Change the compute type of the CodeBuild project to a larger instance, such as 'build.general1.large'.

An 'Out of memory' error directly indicates that the build environment provided by CodeBuild does not have enough RAM for the compilation process. The most direct and efficient solution is to increase the compute resources by selecting a larger compute type.

Why the other options are wrong

  • B. While optimizing the build process is a good long-term strategy, it's not the MOST efficient immediate solution to an 'Out of memory' error, as it requires development effort.
  • C. Increasing timeout would not resolve an 'Out of memory' error; it only allows more time for a process to complete, not more resources.
  • D. CodeBuild's compute environments have fixed memory; while custom Docker images are possible, enabling swap space isn't a standard or efficient way to increase effective memory for compilation in this context and may not be supported or performant.

CodeBuild Compute Types

AWS CodeBuild offers different compute types (e.g., 'small', 'medium', 'large') that determine the amount of CPU and memory allocated to a build environment. Selecting an appropriate compute type is crucial for build performance and resource availability.

  • Directly impacts available vCPUs and memory for the build.
  • Larger types cost more but can resolve resource-intensive build failures.
  • Should be chosen based on the build's resource requirements.

Memory trick: Builds that Break: Resource limits are often the root, so Scale Up or Optimize.

More Troubleshooting and Monitoring questions