Using your own cloud-init when installing your VPS
When installing or reinstalling your VPS, you can provide your own cloud-init. Your VPS runs that file itself on first boot: it installs your packages, creates your users and runs your commands. You don't need an API or a terminal for it.
1. Opening the field
- Log in to My WebOké, go to My Products and click your VPS.
- New VPS: you'll see the Install your VPS block. Reinstalling: choose the Advanced tab and, under Reinstall, click Reinstall....
- Choose the operating system and enter the root password and, optionally, your SSH key.
- Below the SSH key, click Custom cloud-init and paste your file into the field.
- Click the button to install, or click Erase everything and reinstall.
2. What can the file contain?
- A file that starts with
#cloud-config(settings in YAML) or a script that starts with#!.#cloud-boothookand## template: jinjaalso work. - A maximum of 256 KB and text only (UTF-8).
- In YAML, indent with spaces, never with tabs.
- WebOké takes care of the network (IPv4 and IPv6). A custom network-config is not used.
3. An example
This file installs htop and fail2ban, creates the user anna with an SSH key and sudo, and then runs a command:
#cloud-config
hostname: web1
fqdn: web1.example.com
package_update: true
packages:
- htop
- fail2ban
users:
- default
- name: anna
shell: /bin/bash
sudo: "ALL=(ALL) NOPASSWD:ALL"
ssh_authorized_keys:
- ssh-ed25519 AAAAC3Nza... anna@laptop
runcmd:
- timedatectl set-timezone Europe/Amsterdam
Replace the key with your own public key. The example is for Debian and Ubuntu: on AlmaLinux and Rocky Linux, install htop and fail2ban via runcmd, after dnf install -y epel-release.
4. What takes precedence?
WebOké itself provides the hostname, the root password (as a hash) and your SSH key. Your file is merged with these. If you set users, password, chpasswd or ssh_authorized_keys yourself, yours take precedence.
ssh_authorized_keys or password at the top level yourself, they replace the key and the password from the form. In that case, also include the key you want to log in with. In users, keep the line - default at the top.5. Checking whether it worked
cloud-init runs once, on the first boot of your VPS. Then log in and check:
cloud-init status --longshowsstatus: doneif everything worked, orerroralong with the error.- The output of your packages, commands and scripts is in
/var/log/cloud-init-output.log. Details are in/var/log/cloud-init.log. - Use
sudo cloud-init schema --systemto check your file. If the YAML is invalid, cloud-init skips parts of it.
Good to know
- It works for all operating systems in the list: Ubuntu 24.04 and 26.04, Debian 12 and 13, AlmaLinux 9 and 10, and Rocky Linux 9 and 10.
- Your file is passed on encrypted and is not stored in your VPS's task history. Still, don't put any secrets in it that you don't need.
- A VPS is unmanaged. Support does not help with the contents of your cloud-init. All options can be found at docs.cloud-init.io.
Detailed explanation with more examples: Custom cloud-init: set up your VPS automatically on first boot in the VPS manual.
See also: Mount your own ISO or reinstall your VPS and Logging in to your VPS with SSH (and creating an SSH key).
