Weekly Journal 12 - Packer, cloud-init


I spent a little bit of time this week looking at Packer and cloud-init as a way to streamline the creation of AMIs and container images.


Packer is a part of the Hashicorp family of tools. It is a tool that abstracts and automates the creation of machine images. The basic idea is that Packer creates a common interface for creating machine images whether the target environment is AWS, Azure, or a container-based platform like Kubernetes. Packer is supposed to make it easier to incorporate image building into a continuous delivery pipeline.

I am not sure what I think of Packer just yet. The examples in the documentation use shell scripts to provision the image. I dislike using shell scripts because they are not idempotent unless you explicitly program them to be so. We currently use Ansible to create machine images, and Packer lists support for using Ansible, but I am not sure if it is worth using Packer versus using Ansible by itself.

More experimentation is required to determine if it will be useful or not.


cloud-init is a tool that passes user data to a Linux cloud image during first boot. It can be used to configure things like the hostname and SSH keys when a cloud instance is launched. It can even be used to help setup images for a Raspberry Pi. Terraform has built-in support for passing user data to cloud-init, and cloud-init is supported by all of the major cloud providers. I am looking forward to doing more with cloud-init. We currently go through some ungainly maneuvers to perform some of this initial setup using Ansible. I think with cloud-init we can simplify and streamline the startup process.

What’s Next?

If I can find the time, I am hoping to spend some time experimenting further with these tools, and incorporating them into a sample continuous delivery pipeline.