Converting Ubuntu AMI to MaaS base image

Hi Team,

I have a system that uses Packer to build a golden image from an Ubuntu AMI on AWS. This image contains all the prerequisites for my environment. I would like to use the same image for bare-metal machines, which I will deploy using MaaS.

The easiest way to do this would be to convert the base image to a format that MaaS can understand. Is this a recommended approach? Will the converted image work with MaaS deployments?

Has anyone done this before? Any advice would be greatly appreciated.


Maas can take a number of different formats for it’s images, the ones that I remember now are squashfs, tgz and dd, probably others. The most common ones are tgz for custom images (because that is what packer-maas likes to generate by default) and squashfs for upstream maas images. You can easily convert between them (unsquashfs then tar, or untar then squashfs it) and it normally works well.

Canonical has a repository with configs suited for generating images for maas. You can start from there, they are here. These configurations start with the standard cloud image and generate a maas image. In the simplest form it will just boot it, do nothing special, run a few steps specific to this transformation, stop it, pack it in tgz format and give you the custom image that you can add to maas. You can intercept that process and run custom scripts while the machine is live to do further customizations.

I’m not sure how this will fit your workflow for the AMI image. I see two options, you try to use it as source instead of the cloud image or you can start with the cloud image and re-do your customizations again.

I would strongly advise to do a custom script that at least clears the systemd’s machine-id, otherwise your golden image will generate installations that will have duplicated macaddresses for bridges and other strange things.

For adding it to maas, you can use something like:

maas root boot-resources create name="custom/myshortname" title="My Descriptive Name" base_image="ubuntu/jammy" architecture="amd64/generic" subarches="generic" filetype="tgz" content@=/path/custom-cloudimg.tar.gz

Hope that helps.

1 Like

ah, make sure the image is somewhere in your home dir otherwise maas (if you use the snap package) will not be able to access it, and the error will not be obvious.