{"id":2122,"date":"2021-01-08T12:21:25","date_gmt":"2021-01-08T11:21:25","guid":{"rendered":"https:\/\/blog.besharp.it\/?p=2122"},"modified":"2023-02-22T17:19:02","modified_gmt":"2023-02-22T16:19:02","slug":"new-aws-ec2-mac-instances-a-ci-cd-test-bench","status":"publish","type":"post","link":"https:\/\/blog.besharp.it\/new-aws-ec2-mac-instances-a-ci-cd-test-bench\/","title":{"rendered":"New AWS EC2 Mac Instances: our test bench with CI\/CD"},"content":{"rendered":"\n

During the last AWS re:Invent, AWS made one of the most discussed announcement, that \u2014 on paper \u2014 opens a lot of new scenarios: AWS EC2 Mac Instances!
Don’t worry, we will deepen one of these scenarios later on in this blog post, but let’s first introduce this new instance type.
Amazon EC2 Mac Instances come with an 80s name, which makes them more attractive to those of you who are a little bit older than me?
They’re called mac1.metal<\/strong> instances.
Talking about hardware, Amazon EC2 Mac Instances are backed by Mac mini hosts, that rely on AWS Nitro controllers to connect with AWS network infrastructure and services. The interesting point is that Mac Instances are connected to the Nitro System through the Thunderbolt 3 interface. I used the term “host” to highlight the fact that we’re not dealing with Virtual Machines, but with Dedicated Hosts; whenever I decide to run an Amazon EC2 Mac Instance, AWS provisions a concrete Mac mini host for my purposes.<\/p>\n\n\n\n

\"\"
Peter Desantis, Senior Vice President of AWS Infrastructure and Support, presenting new Amazon EC2 Mac Instances at AWS re:Invent 2020 Infrastructure Keynote.<\/figcaption><\/figure>\n\n\n\n

mac1.metal \u2014 the specs<\/h3>\n\n\n\n

At this point \u2014 assuming that you never heard about Amazon EC2 Mac Instances hardware specifications \u2014 you may wonder what are the supported sizes. Well, as far as now, you can forget the word “choice”: AWS allows you to run only one size of Mac Instances. mac1.metal instances’ hardware specifications tell us that they’re powered by an Intel Coffee Lake processor running at 3.2 GHz \u2014 that can burst up to 4.6 GHz \u2014 and 32 GiB of memory. As explained by Jeff Barr in the AWS News Blog, instances run in a VPC, include ENA networking, and are natively Optimized for communication with EBS volumes, supporting I\/O intensive workloads.<\/p>\n\n\n\n

In my daily routine, my working partner is a macOS laptop that I had to update to the new macOS Big Sur operating system. So far it didn’t bring me tangible enhancements, but it’s quite a best-practice to keep your system up to date, at least on your workstation. AWS EC2 Mac Instances come with a limitation in that sense: only Mojave or Catalina macOS versions can be selected. Mojave and Catalina AMIs come with the AWS CLI, Command Line Tools for Xcode, Homebrew, and SSM Agent already installed. AWS is working to add support for Big Sur, and for Apple M1 Chip.<\/p>\n\n\n\n

A practical Use Case<\/h3>\n\n\n\n

Now, let’s focus on what I like the most: practical use cases!<\/p>\n\n\n\n

I started my career as a developer, and I guess every developer’s mind made \u2014 at least \u2014 an association between this announcement and the possibility to automate building, testing, and signing of macOS and iOS applications.<\/p>\n\n\n\n

During the last year, my team has been developing an Open-Source Desktop Application that manages local credentials to access complex Cloud Environments. Our application is written in TypeScript, interpreted by Node.js. We used Angular as our development framework, which runs on top of an Electron engine for cross-platform compatibility.<\/p>\n\n\n\n

Electron comes with a native application builder, called electron-builder, that we used to write custom build scripts in our package.json file, which contains dependencies specifications too. We wrote custom scripts to build Linux, Windows, and macOS binaries.<\/p>\n\n\n\n

In order to build the macOS binary, the script needs to have access to the Signing Certificate and to the Apple Notarisation Password. They allow, respectively, to sign and notarize the macOS binary. We usually store these secrets in our macOS Keychain, run the build scripts on our local environments, and manually upload the artifacts on our GitHub repository as a new release. This is a common practice adopted by many developers when building macOS or iOS applications.<\/p>\n\n\n\n

This process is slow, cumbersome, and may lead to human errors. But hey, there seems to be a new opportunity out there for us. What better Use Case for the new Amazon EC2 Mac Instances than building our application’s macOS binary?<\/p>\n\n\n\n

It’s time to focus on how I set up the test bench. We will go through the following steps:<\/p>\n\n\n\n