Cloud-init is the industry standard for customizing cloud instances during their very first boot. It allows you to configure users, install software, and run scripts automatically without ever logging in manually.
At Tilaa, all our Linux images come with Cloud-init pre-installed. You can supply your configuration via the "User Data" field during deployment (via the Dashboard or API).
Supported Operating Systems
Cloud-init is available on all our standard Linux distributions:
- Ubuntu / Debian
- AlmaLinux / Rocky Linux / CentOS
- Arch Linux
Writing a Cloud-Config Script
The most common format for User Data is YAML. It must always start with the line #cloud-config.
YAML is whitespace-sensitive. Use spaces (not tabs) for indentation, otherwise the script will fail silently.
Example 1: Basic User Setup
This script creates a new user, gives them sudo rights, and adds an SSH key.
#cloud-config
users:
- name: deployuser
groups: sudo, wheel
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC... (your key here)
lock_passwd: true
Example 2: Install Software (Web Server)
This script updates the system, installs Apache, and creates a default index page.
#cloud-config
package_update: true
package_upgrade: true
packages:
- httpd
- php
runcmd:
- systemctl enable httpd
- systemctl start httpd
- echo "Hello World from Cloud-init" > /var/www/html/index.html
How to Apply User Data
- Dashboard: In the VPS Configurator, look for the "User Data" or "Cloud-init" text area during the checkout process. Paste your script there.
-
API: When creating an instance via the API, pass your script (Base64 encoded) in the
user_datafield.
Troubleshooting
If your script didn't do what you expected, you can check the logs inside the server to see what went wrong.
1. Check the output log:
This shows the console output of your commands.
cat /var/log/cloud-init-output.log
2. Check the processing log:
This shows parsing errors (e.g., invalid YAML).
cat /var/log/cloud-init.log
No. By default, Cloud-init modules run only once during the very first boot after provisioning. To force it to run again, you must clean the artifacts:
cloud-init clean.