Ephemeral VMs and CI Orchestration on AWS EC2 Mac with Anka

Amazon EC2 Mac instances provide a way for iOS development teams to configure iOS CI infrastructure on AWS without the hassles of hosting and managing the mac hardware themselves. These EC2 Mac instances offer a usage-based pricing model (minimum 24-hour threshold), unlimited scalability of mac hardware with minimal management overhead, worldwide access for distributed development teams, up-to-16K-IOPs, up-to-16-TiB and flexible VolumeSize to whichever Amazon EBS size you want. Anka Build enables you to set up an orchestration layer to provision Ephemeral macOS VMs on a cluster of EC2 Mac Instances.

We expect that most iOS development teams will be looking at migrating their on-premise or hosted iOS mac infrastructure to AWS mac cloud EC2 instances. There are, however, some open questions that need to be sorted out.

  1. How do you achieve identical macOS build server environments for all build and test jobs?
  2. How do you automatically provision macOS build servers on-demand?
  3. How do you automatically register on-demand provisioned macOS build servers as workers/agents/runners in the CI system?
  4. How do you overcome the EC2 macOS build server startup time of 5 – 8 minutes?
  5. How do you manage the on-demand availability and scalability needs with 50 – 120 minutes it takes to clean up the EC2 mac metal host and start a new macOS build server on it?
  6. How do you optimize the overall cost?
 

You can resolve these questions by running ephemeral and immutable macOS build server containers on top of a cluster of AWS EC2 Mac instances. We recommend running the macOS virtualization layer and orchestration provided by Anka Build on top of the Amazon EC2 Mac instances.

Get started with an Anka Build trial license key. We have scripts that will set up the complete orchestration. You can find them under our Getting Started repo’s AWS folder. There are two scripts available:

prepare-build-cloud.bash

  • Running this script will create everything necessary inside of AWS to run an Anka Build Cloud. This includes a security group, elastic IP, etc.

prepare-anka-node.bash

  • Running this script will create everything necessary inside of AWS to run a mac1.metal instance and then install Anka inside. You’ll be prompted for the Anka license to use if the ANKA_LICENSE env variable is not set.

Both scripts can be run locally from your macOS hardware with an existing AWS credential.

Identical macOS build server environments for all build and test jobs

Using Anka macOS virtual machines on top of EC2 Mac instances gives you the ability to have identical build environments across all builds and test jobs. Automate creating macOS base virtual machine images(templates) with packer, store and manage them in Anka Registry(running in your AWS VPC). Manage the build software dependencies inside the macOS environment by creating tags on top of base images.

Anka Controller(orchestrator) will start identical macOS build environments from base image+tag for CI build jobs.

Automatically provision macOS build servers on demand.

When your CI system runs iOS jobs, Anka Controller(running in your AWS VPC) gets all those requests and starts concurrent macOS virtual machines across a cluster of EC2 Mac instances from a specific base image+tag. Anka Controller terminates the virtual machines when the jobs are completed. You can run multiple macOS build VMs on each EC2 Mac instance with minimal performance degradation. Anka Controller can start multiple macOS VMs from different base images on the same EC2 Mac Instance. So, you can run concurrent builds in a Catalina and Big Sur VM or two different Xcode versions on the same EC2 Mac instance.

Automatically register on-demand provisioned macOS build servers as workers/agents/runners in the CI system.

Anka Controller(Orchestrator) provides plugins or integrations for most CI systems and enables automatic registration of macOS virtual machines as workers/agents/runners.

Jenkins – Install the Anka Plugin to directly start macOS VMs from Jenkins jobs on AWS EC2 Mac instances.

TeamCity – Install the Anka Plugin to directly start macOS VMs from TeamCity jobs on AWS EC2 Mac instances.

GitLab CI – Install the Anka GitLab CI runner to directly start macOS VMs from GitLab CI on AWS EC2 Mac instances.

BuildKite – Use the Anka BuildKite integration to start macOS VMs from BuildKite on AWS EC2 Mac instances.

GitHub Actions – use the Anka GitHub Actions integration to start macOS VMs from BuildKite on AWS EC2 Mac instances.

You can use the Anka Controller APIs to integrate and start macOS VMs on AWS EC2 Mac instances for any other CI system.

 

Overcome the EC2 macOS build server startup time of 5 – 8 minutes

Anka Controller starts macOS VMs on EC2 Mac instances from VM template images in 1-2 seconds. The VMs are connected to the CI system in a few seconds and ready to execute jobs.

Get around the 50 – 120 minutes it takes to clean up the EC2 mac metal host and start a new macOS build server.

You can easily scale and increase the number of available macOS build servers by starting new macOS VMs across the EC2 mac instance cluster.

Optimize the overall cost

Anka on EC2 Mac instances enables you to orchestrate starting multiple macOS build servers on each EC2 Mac Instance. You can increase your available capacity for CI.

 

Share this post

Share on facebook
Share on twitter
Share on whatsapp
Share on linkedin
Share on email