Recently, the AWS Compute Blog wrote an excellent introduction to “Getting Started with Anka on EC2 Mac Instances“. In the blog, they covered allocating an EC2 Mac Dedicated Host; launching a mac1.metal instance on it; installing and configured Anka for “type-2 virtualization and orchestration”; and finally, successfully launching and running commands inside a macOS virtual machine. However, in this blog, we’d like to elaborate on a few of the benefits of running Anka on AWS EC2 Mac Instances.
EC2 mac1.metal instances are powerful tools to use for macOS CI/CD. They take away the hassle of maintaining and managing Apple infrastructure for CI while also enabling quick short-term scaling to handle increased demand. With Anka running on these EC2 mac instances, you can transform your static CI agents into on-demand and ephemeral agents, maximizing resource utilization.
It’s usually the case that CI/CD jobs are not always running 24/7, and having instances sit around can be costly. Anka on EC2 allows you to maintain fewer EC2 instances as you can run multiple ephemeral Anka VMs at a time, allowing you to double your macOS and iOS build/test fleet. This is on top of the on-demand sandboxed environments, ensuring a clean build/test environment for each pipeline and job — it’s a perfect match!
Without Anka VMs, you have to prepare and then clean up the ec2-user environment for each run and can even then, usually, only safely run a single job on an instance at a time. The DevOps effort necessary to create Anka VM Templates/Tags and then push them to a centralized registry is less than creating custom preparation and cleanup logic.
If you’re curious about how to automate the creation of Anka VM Templates and Tags, here are some options and examples:
You can find information about how Anka VM Templates and Tags work on our documentation site.
Another massive benefit of using Anka on AWS is intranet transfer speeds for Node and Registry communications. Switching between the project-specific dependencies/VMs requires, initially, that you pull the layers you need from the Anka Build Cloud Registry. If those layers happen to be several GBs or more, you’re looking at slight delays to your CI/CD builds/tests starting. Pulling and pushing VM Templates and Tags within the AWS network is blazing fast.
Already have an AWS account and want to easily create everything you need to play around with Anka Virtualization and/or the Anka Build Cloud? We have a set of scripts you can use to do just that! 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. To obtain a trial Anka license, visit our website.
DevOps teams love automation, speed, and easy-to-maintain solutions. Anka is a perfect solution for DevOps teams. Two of our favorite DevOps practices are “shifting left” and self-service. Both of these are why we created Anka Flow, a version of the Anka Virtualization software developers can install on their laptops to run and even create Anka VMs. Once VMs are prepared, developers can either push their new VM Template/Tag to the Registry or update a script in their project repo that, when updated, triggers a CI/CD job that does the creation and pushing to the centralized Registry so your AWS EC2 macOS instances can use it. This sort of Anka VM per project/repo preparation script and automation allows developers to create their own VM Templates/Tags whenever a new dependency is needed or changes, without involving DevOps teams, and makes Anka Flow a great way for them to test that the script not only installs what they want in the VM but also successfully runs the project code they have locally without requiring CI/CD.
We’re excited about the future of both products. As time goes on we’ll continue to see emerging use-cases and benefits of this powerful combination.