Building a custom AMI with Packer
RunsOn provides base images (AMIs) for your workflows, which are regularly updated β.
In some cases though, you might want to generate a new AMI from one of those base images, and use it in your workflows.
This can be useful if you want to:
- prepopulate the AMI with your own software, docker images, data, etc.
- fulfill advanced compliancy requirements, with a stable image that you control.
An easy way to do this is to regularly rebuild your own AMI from the base images with Packer.
Manifest file
In this example we will generate a new AMI for arm64.
User data file
A user-data is required to start the SSH daemon, otherwise Packer canβt connect to the instance to perform the provisioning.
In the example this would be a file in scripts/user_data.sh
:
Provisioning file
The provisioning file is where you put your scripts to install software, run commands, etc.
In the example this would be a file in scripts/provision.sh
:
Building the image
Initialize Packer:
Then build the image:
After some time you should get a new AMI registered into your AWS account, and you can start using it by referencing the AMI ID or name in your workflows.
See the documentation on custom images for more details.