Getting Started with cloud-init

Originally published at:

cloud-init is an awesome technology that can be used to customize Linux images for deployment, that lets you do all kinds of neat things such as automatically creating users, installing packages, resetting SSH keys, and more. However, it’s often shrouded in mystery. In this video, I’ll walk you through using it to create a user, set the hostname, and install some packages.

1 Like

Interesting, I will try creating a couple of base templates for common VMs I run.

One caveat. If you have been playing with proxmox and reading their cloud-init documentation they reference

Add Cloud-Init CD-ROM drive

as a necessary part of setting up cloud-init. This seems to contradict the video.

After some thought and experimentation. It seems that many recent distributions already have cloud-init installed with some basic configuration. Thus whenever you first boot a distro such as Ubuntu Server 21.04 Cloud-init runs.

In the video above @Jay demonstrates modifying the /etc/cloud/cloud.cfg .This creates a standalone cloud-init image.

The cd-image referenced in the proxmox documentation is a way of providing supplemental information to cloud-init which over rides the standard configuration in /etc/cloud/cloud.cfg. Most VM managers and cloud providers seem to provide different methods of injecting data into the cloud-init process. I think that is what jay is removing with the 99-fake-cloud.cfg.

Maybe I should set up an account and Linode and test it out. If only there were a way to experiment on linode for free…