AWS Certified Solutions Architect – Associate (SAA-C03)Design Cost-Optimized ArchitecturesHard

A software development company is using AWS CodeBuild for its continuous integration pipeline. They have several build projects that run frequently throughout the day. To optimize costs, they want to ensure that CodeBuild environments are not idle for longer than necessary after a build completes. Which CodeBuild feature helps achieve this cost optimization?

  1. ASet the compute type to 'BUILD_GENERAL1_SMALL'.
  2. BSpecify a 'timeoutInMinutes' in the buildspec file.
  3. CConfigure build caching for dependencies.
  4. DEnable 'Stop build if idle' setting in the project configuration.
Show answer & explanation

Correct answer: D. Enable 'Stop build if idle' setting in the project configuration.

The 'Stop build if idle' setting in CodeBuild automatically terminates the build environment if it detects no activity, preventing unnecessary billing for idle compute time after a build finishes or if it gets stuck. This directly optimizes costs by ensuring you only pay for the active build duration.

Why the other options are wrong

  • A. Setting the compute type to 'BUILD_GENERAL1_SMALL' might reduce the cost per minute, but it doesn't address the issue of idle time after a build completes or if a build gets stuck. It's a sizing optimization, not an idle-time optimization.
  • B. Specifying a 'timeoutInMinutes' prevents a build from running indefinitely if it gets stuck, which is a cost control measure for runaway builds, but it doesn't specifically address the cost of an environment being idle after a successful (or failed but completed) build.
  • C. Configuring build caching for dependencies reduces build times, which indirectly saves costs by shortening the active build duration, but it doesn't prevent billing for idle time after the build is technically 'done' or stuck.

CodeBuild Stop Build If Idle

The 'Stop build if idle' setting in AWS CodeBuild automatically terminates the build environment if it detects no activity, preventing unnecessary billing for idle compute time.

  • Optimizes costs by only paying for active build duration.
  • Prevents billing for environments that become unresponsive or idle.
  • Configured per CodeBuild project.
  • Helps manage costs for frequently running CI/CD pipelines.

Memory trick: Idle No More, Costs Explode No More.

More Design Cost-Optimized Architectures questions