Cloud init

Cloud-init is a standard way to initialize VPS instances starting from OS images on VMs on first boot. I use it to initialize everything on the VM required to run the desired applications. So for example you can set up the following options using cloud-init:

  • hostname
  • users and auth keys
  • timezone
  • installation and configuration of software
  • database setup

Much more is possible – consult the official documentation for everything else.

You provide your own options as a chunk of .yaml as so called user data which is everything you decide in addition to everything the hosting provider decides. As you can write files and run shell commands as part of your yaml-recipe the possibilities are endless.

I ran my cloud-init recipes successfully on

  • ProxMox VM
  • Hetzner Cloud

Example

This ist an example cloud-init recipe

#cloud-config
hostname: example
manage_etc_hosts: true
ssh_authorized_keys:
  - ...
chpasswd:
  expire: false
users:
  - default
disable_root: false
timezone: Europe/Berlin
apt:
  sources:
    suryphp:
      source: ppa:ondrej/php
package_upgrade: true
packages:
  - apt-transport-https
  - mailutils
  - git
  - curl
  - rsnapshot
  - screen
...

To explore

Cloud-init is a standard to initialize cloud instances.

But for some setups a baremetal server is still the best option. For example you usually get the most power for the best price using baremetal. So it would be great to reuse your tested cloud-init recipes on baremetal systems. I assume that it should be possible using the NoCloud datasource. But the hosting provider of your choice has to support getting that user-data config into the OS image. For Ubuntu this should be possible using autoinstall.