What is cloud-init and what does it do at first boot?
BeginnerProductionPatching, Automation & Golden Images
Answer
cloud-init reads instance metadata and user-data on first boot and configures the instance: hostname, users and SSH keys, package installs, files, and arbitrary commands.
#cloud-config
package_update: true
packages: [nginx]
write_files:
- path: /etc/app/env
content: "ENV=prod\n"
runcmd:
- systemctl enable --now nginx
Debug with cloud-init status --long and /var/log/cloud-init-output.log.
More on Patching, Automation & Golden Images
What does a good Linux patching strategy look like?BeginnerIn-place patching vs immutable image replacement: which do you prefer?IntermediateHow do you know whether a server needs a reboot after patching?BeginnerHow do you configure automatic security updates?BeginnerWhat is kernel live patching?IntermediateHow do you roll kernel updates across a 200-node fleet safely?Advanced