AWS CodeBuild – Fully Managed Build Service
Developers typically have to set up and operate a shared build server to run continuous integration builds and tests on their source code changes. Because of the maintenance overhead, many developers avoid that and just run builds on their local machines, often leading to situations where code that works for one developer does not work when rebuilt in the final production environment.
Many development teams set up build farms that are put to use as part of their CI/CD (Continuous Integration / Continuous Deployment) pipelines. These build farms are expensive to set up and maintain, and require a different set of skills. They are often lightly used, except at crunch time, when utilization hits 100% and the backlog of build requests grows.
Introducing AWS CodeBuild
Today we are introducing AWS CodeBuild to address these challenges. Instead of spending time setting up, scaling, and patching a fleet of build servers, you can use CodeBuild to streamline your development process, while also avoiding many different types of inconsistencies and discrepancies. You don’t need to provision servers ahead of time; CodeBuild will scale to accommodate your build volume instead of letting pending builds stack up. You pay for build resources on a minute-by-minute basis, paying only for what you use, with prices starting at $0.005 (one half of a cent) per minute.
CodeBuild is a managed build service. It is elastic, scalable, and easy to use. To start, you need do nothing more than create a build project that contains the information needed to perform a build. This includes the following elements:
- Source Repository – Source code location (AWS CodeCommit repository, GitHub repository, or S3 bucket).
- Build Environment – Language / runtime environment (Android, Java, Python, Ruby, Go, Node.js, or Docker).
- IAM Role – Grants CodeBuild permission to access to specific AWS services and resources.
- Build Spec – Series of build commands, in YAML form.
- Compute Type – Amount of memory and compute power required (up to 15 GB of memory and 8 vCPUs).
CodeBuild performs each build in a fresh, isolated, container-based environment. Here’s what happens:
- CodeBuild launches a container that is based on the build environment that you specified in the build project. We provide curated build environments for Android, Java, Python, Ruby, Go, Node.js, and Docker (to build Docker images). You can also use existing Docker images from Docker Hub or from Amazon Elastic Container Registry (Amazon ECR). The curated build environments include the AWS Command Line Interface (CLI).
- CodeBuild arranges to capture and stream all of the command-line output from your build to the AWS Management Console during the build process.
- CodeBuild fetches the code from the source repository indicated in the build project.
- CodeBuild runs the commands in the build project. the commands can include install, pre-build, build, and post-build phases, all identified in the project’s Build Spec.
- CodeBuild uploads the generated executable or other artifacts to S3, with optional AWS Key Management Service (AWS KMS) encryption.
- CodeBuild destroys the container that was used for the build.
You can use CodeBuild as a AWS CodePipeline build provider, making it an ideal addition to your existing CI/CD process. CodeBuild makes uses of other AWS services including S3 and AWS Identity and Access Management (IAM).
The curated build environments include the AWS CLI and the AWS SDKs. This enables you to create a fully automated CI/CD workflow for your serverless applications, using CodePipeline and AWS SAM. You can pull down npm or pip packages, package it up using the AWS CLI, and have it all ready for deployment.
AWS CodeBuild in Action
While I didn’t have time to fully exercise AWS CodeBuild with an in-depth walk-through, I’ve included some screen shots here to give you an initial feel for the service features.
List of build projects:
Detailed information for a single build:
AWS CodeBuild is available now and you can start using it today! We are launching with support for Linux builds and are planning to add support for Windows in the near future.
You can learn more on January 20th during our webinar. Sign up for it here.