CodeBuild is an Amazon Web Service tool for automating the building of software. Now you can use it to build macOS and iOS apps.
Amazon AWS CodeBuild service.
(AWS) is a comprehensive set of cloud computing services that allow you to ditch your on-premises hardware. With AWS you can shift much of your IT infrastructure to the cloud, leveraging the power of Amazon's vast resources for your compute workloads.
AWS offers a limited free tier for some cloud services, but most services require a monthly or hourly fee. In some cases, you pay only for what you use.
CodeBuild is a web service Amazon provides to allow developers to use Continuous Integration and Continuous Delivery (CI/CD) pipelines to automate building and delivering software and online services.
With CodeBuild, you can use Amazon cloud resources to build most of your software and deliver it. All without having to manage the details of the build server hardware and configuration.
Using development environment container images, you can also specify custom-build server configurations on AWS to build and deploy your workloads. AWS uses Docker container images for environment deployment.
There's also a Docker desktop app for Mac OS.
The idea with container images is so you can configure your build environment once and save it to an image. You can then deploy the image anywhere and avoid having to do the configuration each time.
Doing macOS or iOS builds on CodeBuild was previously unavailable, but that all changed on 19 August.
In an AWS blog post Sebastien Stormacq of Amazon announced Mac support in CodeBuild. Since most apps for Apple platforms use Apple's own Xcode development tools to perform builds, you'll need to run Xcode on a Mac in most cases.
Along with Source Code Management (SCM) tools such as git, GitHub, and GitLab, your build system can be fully automated using AWS CodeBuild.
You can also use CodeBuild to create tvOS and watchOS apps.
CodeBuild leverages Amazon's other web services, which include general compute, images, and authorization services.
Getting started
CodeBuild isn't one of the AWS services included in Amazon's free tier, so you'll need to pay for it.
There are two models of pricing for CodeBuild: one in which you pay for a full 24-hour cycle, and one where you pay only for the actual hours used on AWS when you use CodeBuild.
Oddly, this is in part because Apple's macOS license agreement requires a minimum 24-hour period for any "leased permitted developer services".
All of the AWS CodeBuild Mac services run on Mac minis in one of two configurations:
- 24GB/8 CPU @ $28.80/24 hours
- 32GB/12 CPU @ $51.84/24 hours
AWS operates on the concept of cloud instances that use Amazon's own Elastic Compute Cloud (EC2). Each instance represents a virtual computing resource that runs in the cloud - effectively a cloud server from the consumer's standpoint.
In the AWS free tier, you can get a whopping 750 hours per month for twelve months, but this doesn't include the CodeBuild service.
CodeBuild uses two cloud capacity models, called on-demand and reserved capacity. Amazon calls them 'capacity fleets.'
If you're using the on-demand model you get automatic scaling, and pay only for build minutes used. With reserved capacity, you reserve an entire 24 hours or more for build and those AWS instances can't be released until the 24 hours have elapsed.
The default macOS CodeBuild image includes all the tools you need, including Xcode, the .NET SDK, Go, Java, Fortran, Kotlin, clang and Swift compilers, and a host of web-based tools. You can also create custom images if you like.
AWS regions
AWS has various regions around the world, with the Mac instances operational in Ohio, Virginia, Oregon, Frankfurt, and Sydney. You can specify regions in your AWS configuration, or let the service decide where to run the instances.
Amazon has a full table of which AWS services are available in which regions.
Configuration
Once you've signed up for CodeBuild, you'll need to configure your Mac services by going to the reserved capacity macOS fleet page and following the instructions there.
Also, check out the Reserved Fleet Properties page.
You can also use AWS's Virtual Private Cloud services. Once instances are provisioned and set up, it takes about eight to ten minutes for them to come online and be ready to use.
It's advisable for you to read the basic AWS CodeBuild docs, and the macOS image runtimes subsection.
There's also an Amazon EC2 Mac Instances section on the AWS News Blog.
Obviously, the CodeBuild service isn't cheap, but for large and mid-sized organizations it could save money. Without a cloud build service, you'll need to have build and network infrastructure to run builds - and employees to manage it.
By using cloud build services, you can let AWS automate and manage your builds so you don't have to.