Interview Prep/Linux/Patching, Automation & Golden Images

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.

All Linux questions Roadmap: Linux

More on Patching, Automation & Golden Images