AWS in 1 Min · Episode 170

AWS CodeBuild explained: managed builds without build servers

Builds without build servers. Watch the one-minute video, then read the details.

David Gomez1:12 video · 3 min read

"You need your own build server." Not anymore. A self-managed build server needs patching, sits idle at night, and becomes a queue the moment the whole team pushes before a release. AWS CodeBuild removes that server: it is a fully managed build service that compiles your code, runs tests and produces packages ready to deploy, and you pay only for the build minutes you use.

The buildspec: your build as code

You describe the build in a YAML file called buildspec.yml, by default in the root of your repository. Because it lives next to the code, the build steps are reviewed, versioned and rolled back like any other change. No more "it only builds on one person's laptop."

A buildspec is split into phases that run in order:

  • install: install tools and pick runtime versions (for example nodejs: 20.x).
  • pre_build: log in to Amazon ECR, install dependencies.
  • build: compile and run tests.
  • post_build: package, push an image, send a notification.

If any command in a phase fails, the phase fails, and by default the build fails with it. A finally block runs cleanup commands even when a command fails.

Fresh, parallel and disposable

Every build starts in a fresh environment from a build image you choose (AWS-provided images or your own). Nothing leaks between builds, and CodeBuild scales automatically, so ten developers pushing at once get ten builds, not a queue. Besides the default EC2-based compute, CodeBuild also offers Lambda compute for short builds and reserved capacity fleets when you need warm, dedicated machines.

What comes out

  • Artifacts: the files you list go to an Amazon S3 bucket (or you push a container image to ECR instead).
  • Reports: test results (JUnit XML and other formats) and code coverage become reports you can browse per build.
  • Secrets: the env section pulls values from AWS Secrets Manager or Parameter Store, so passwords never sit in the repository. CodeBuild masks those exact values in the logs.

A common mistake: putting secrets in plain-text environment variables on the project. They are visible in the console and API. Use the secrets-manager or parameter-store mappings, and give the CodeBuild service role only the permissions that build needs.

CodeBuild runs on its own or as the build and test stage of a pipeline in AWS CodePipeline, the next episode in this series.

Where AI fits

You can put an AI code review inside the build. Add a step in pre_build or build that sends the diff to a model on Amazon Bedrock, writes the findings to a report, and exits with an error when it flags something serious, such as a hard-coded secret or a missing authorization check. The build then fails before bad code reaches a pipeline. This is a pattern you script yourself, not a built-in CodeBuild feature: keep the prompt and the pass/fail threshold in the repository, and treat the model as a reviewer, not as the only gate.

Note on older tools: Amazon CodeGuru Reviewer no longer accepts new repository associations (since 7 November 2025); existing associations keep working. AWS points new users to other code-analysis options, such as Amazon Inspector code security scanning.

Quick recap

  • No build servers: CodeBuild is managed, scales on demand and bills per build minute.
  • buildspec.yml lives with the code: install, pre_build, build, post_build.
  • AI review can gate the build, with secrets kept in Secrets Manager, not in the code.
AWS in 1 Min #170 · 1:12

Need an AWS expert on your team?

I'm David, an AWS expert and fractional cloud consultant. I work alongside your team to run your cloud and infrastructure: architecture, security, cost and day-to-day operations. You get senior AWS experience when you need it, without the cost of a full-time hire.

  • Architecture reviews and a clear plan for what to fix first
  • Security hardening: IAM, networking, audits
  • Lower AWS bills without slowing your team down
  • Hands-on help with AI workloads on AWS