12.2 C
New York
Sunday, November 17, 2024

EC2 Picture Builder now helps creating and testing macOS pictures


I am excited to announce macos help in EC2 Imager. This new functionality permits you to create and handle machine pictures to your macOS workloads, along with present help for Home windows and Linux.

A gold picture is a bootable disk picture, additionally referred to as Amazon Machine Picture (AMI)Preinstalled with the working system and all of the instruments mandatory to your workloads. Within the context of a steady integration and deployment (CI/CD) pipeline, your golden picture will more than likely include the particular model of your working system (macOS) and all the event instruments and libraries mandatory to construct and check your purposes (Xcode, quick laneand so forth.)

Manually creating and managing pipelines to create macOS grasp pictures is time-consuming and diverts gifted sources from different duties. And when you’ve got present pipelines for creating Linux or Home windows pictures, you must use completely different instruments to create macOS pictures, leading to a disjointed workflow.

For these causes, lots of you’ve got been asking for the flexibility to handle your macOS pictures utilizing EC2 Picture Builder. You wish to consolidate your picture pipelines throughout working techniques and make the most of the automation and cloud-centric integrations that EC2 Picture Builder offers.

By including macOS help to EC2 Picture Builder, now you can streamline your picture administration processes and scale back the operational overhead of sustaining macOS pictures. EC2 Picture Builder takes care of testing, versioning, and validating base pictures at scale, saving you the prices related to sustaining your most well-liked variations of macOS.

Let’s examine it in motion
Let’s create a pipeline to create a macOS AMI with Xcode 16. You possibly can observe an identical course of to put in Fastlane in your AMIs.

At a excessive degree, there are 4 fundamental steps.

  1. I outline a element for every device I wish to set up. A element is a YAML doc that tells EC2 Picture Builder which utility to put in and the way. On this instance, I create a customized element to put in Xcode. If you wish to set up Fastlane, create a second element. I take advantage of the ExecuteBash motion to enter the shell instructions wanted to put in Xcode.
  2. I outline a recipe. A recipe begins from a base picture and lists the elements I wish to set up on it.
  3. I outline the infrastructure configuration I wish to use it to construct my picture. This defines the set of Amazon Elastic Compute Cloud (Amazon EC2) cases to construct the picture. In my case, I assign an EC2 Mac devoted host in my account and reference it within the infrastructure settings.
  4. I create a pipeline and a schedule to run on the infrastructure with the given recipes and a picture workflow. I check the outbound AMI and ship it to the chosen vacation spot (my account or one other account)

It is a lot simpler than it appears. I’ll present you the steps within the AWS Administration Console. I can even configure EC2 Picture Builder with the AWS Command Line Interface (AWS CLI) or write code utilizing one among our AWS SDK.

Step 1: Create a element
I open the console and choose EC2 Imagerso Elementsand eventually Create element.

Image Builder: Create Component

I choose a base Picture working system and the Supported OS variations. Then I enter a Element title and Element model. I choose Outline the content material of the doc and enter this YAML as Content material.

title: InstallXCodeDocument
description: This downloads and installs Xcode. Make sure to run `xcodeinstall authenticate -s us-east-1` out of your laptop computer first.
schemaVersion: 1.0

phases:
  - title: construct
    steps:
      - title: InstallXcode
        motion: ExecuteBash
        inputs:
          instructions:
             - sudo -u ec2-user /choose/homebrew/bin/brew faucet sebsto/macos
             - sudo -u ec2-user /choose/homebrew/bin/brew set up xcodeinstall
             - sudo -u ec2-user /choose/homebrew/bin/xcodeinstall obtain -s us-east-1 --name "Xcode 16.xip"
             - sudo -u ec2-user /choose/homebrew/bin/xcodeinstall set up --name "Xcode 16.xip"
  
  - title: validate
    steps:
      - title: TestXcode
        motion: ExecuteBash
        inputs:
          instructions:
            -  xcodebuild -version && xcode-select -p   

I take advantage of a device I wrote to obtain and set up Xcode from the command line. xcode set up integrates with AWS Secrets and techniques Supervisor to securely retailer net authentication tokens. Earlier than working the pipeline, I authenticate from my laptop computer with the command xcodeinstall authenticate -s us-east-1. This command begins a session with the Apple server and shops the session token in Secrets and techniques Supervisor. xcodeinstall makes use of this token through the picture creation course of to obtain Xcode.

While you use xcodeinstall with Secrets and techniques Supervisor, you have to grant your pipeline permission to entry secrets and techniques. Right here is the coverage doc I added to the position connected to the EC2 occasion utilized by EC2 Picture Builder (within the following infrastructure configuration).

{
	"Sid": "xcodeinstall",
	"Impact": "Enable",
	"Motion": (
            "secretsmanager:GetSecretValue"
            "secretsmanager:PutSecretValue"
        ),
	"Useful resource": "arn:aws:secretsmanager:us-east-1::secret:xcodeinstall*"
}

To check and debug these elements regionally, with out having to attend a protracted cycle in addition and recycle the EC2 Mac occasion, you need to use the AWS Job Orchestrator and Executor (AWSTOE) Command.

Step 2: Create a recipe
The subsequent step is to create a recipe. Within the console I choose Picture recipes and Create picture recipe.

I choose macOS as a base Working system picture. I select macOS Sonoma ARM64 as Picture title.

In it Construct elements part, I choose the Xcode 16 element that I simply created throughout step 1.

Lastly, I ensure the amount is giant sufficient to retailer the OS, Xcode, and my builds. I normally choose one among 500 GB gp3 quantity.

Image generator: create a recipe

Steps 3 and 4: Create the pipeline (and infrastructure configuration)
in it EC2 Imager web page, choose Picture Pipelines and Create picture pipeline. I give my pipeline a reputation and choose a Building schedule. For this demonstration, I choose a guide shutter launch.Image Builder: Create Pipeline 1

Subsequent, I choose the recipe I simply created (Sonoma-Xcode).

Image Builder: Create Pipeline 2

I selected Default workflows for Outline the picture creation course of. (not proven for brevity).

I create or choose an present infrastructure configuration. Within the context of making macOS pictures, you have to assign Amazon EC2 Devoted Hosts first. That is the place I select the kind of occasion that EC2 Picture Builder will use to create the AMI. I can even optionally choose my digital non-public cloud (VPC), safety group, AWS Identification and Entry Administration (IAM) roles with permissions required throughout picture preparation, key pair and all of the parameters that I usually choose when beginning an EC2 occasion.

Image Builder: Create Pipeline 4

Lastly, I choose the place I wish to distribute the output AMI. By default, it stays in my account. However I can even share it or copy it to different accounts.

Image Builder: Create Pipeline 5

run the pipeline
Now I am able to run the pipeline. I choose Picture Pipelinesthen I choose the pipeline I simply created (Sonoma-Xcode). From Conduct menu, choose Run pipeline.

Image Builder - Launch Process

I can observe the progress and detailed data of Amazon CloudWatch.

After some time, the AMI is created and able to use.

Image Builder: AMI build succeeded

Testing my AMI
To complete the demo, I begin an EC2 Mac occasion with the AMI I simply created (bear in mind to assign a devoted host first or reuse the one you used for EC2 Picture Builder).

As soon as the occasion begins up, I hook up with it utilizing safe shell (SSH) and confirm that Xcode is put in accurately.

Image Builder - Connect to a new AMI

Costs and availability
EC2 Picture Builder for macOS is now obtainable in all AWS Areas the place EC2 Mac cases can be found: US East (Ohio, Northern Virginia), US West (Oregon), Asia Pacific (Mumbai, Seoul, Singapore, Sydney, Tokyo), and Europe (Frankfurt, Eire, London, Stockholm) ( Not all Mac occasion sorts can be found in all Areas.)

There isn’t a extra price and you’re solely charged for the sources in use through the execution of the method, that’s, the time that your EC2 Mac devoted host is allotted, with a minimal of 24 hours.

Previewing macOS help in EC2 Picture Builder permits you to consolidate your imaging pipelines, automate your golden picture creation processes, and leverage the advantages of cloud-centric integrations on AWS. Because the EC2 Mac platform continues to broaden with extra occasion sorts, this new functionality positions EC2 Picture Builder as a complete resolution for picture administration on Home windows, Linux, and macOS.

Create your first pipeline as we speak!

— seb



Related Articles

Latest Articles