User data

User data

User data are scripts that use the cloud-config format, designed to be run by the cloud-init process. These scripts are generally used for the initial configuration of a server and run on the first boot.

Deploying a server with user data allows you to run arbitrary commands and change several aspects of the server during provisioning.

Here are a few examples of what you can do with user data scripts:

  • Change user passwords
  • Server hardening
  • Notify people or systems that a new device has been deployed
  • Install packages and dependencies


Here are the operating systems that currently support setting user data and the directive you should use when writing your scripts.

Linux- Ubuntu 16.04 LTS and newer
- CentOS 7.4 and newer
- Rocky Linux
- Debian 10 and newer
- RedHat Enterprise Linux
Windows- All Windows images# ps1_sysnativePowerShell
Flatcar- Flatcar# !/bin/bashBash

File format

UNIX-like systems

If you're using a UNIX-like OS like Linux, your scripts must be written using the YAML file format, which uses whitespace and new lines to delimit lists, associative arrays, and values.

Here's an example of a user data script that uses the {{ PASSWORD }} variable to change the root password and allow for root logins.

user: root
chpasswd: {expire: false}
password: {{ PASSWORD }}
disable_root: false
ssh_pwauth: true
- echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
- systemctl restart ssh

These files are generally fairly intuitive and easy to understand, but there are a few things you need to keep in mind when using them. Here is a good getting started guide that can help.

Windows systems

For Windows, you'll have to use the cloud-baseinit convention. This is just a fancy way of saying that your user data will have to be written as if you were using Powershell. Here's a straightforward example:

mkdir c:/test
New-Item c:/test/test.txt
Set-Content c:/test/test.txt 'Hello World'

Creating a user data

Before creating a user data script, make sure you're using the correct directive and programming language for the operating system you'll be using it with.

From a template

You can start with user data scripts by choosing one of the provided templates. From package updates to notifying Slack on deploys, we‘ve added templates for different use cases.

  1. Go to the dashboard and select a project
  2. Click on Project settings and then on the User data tab
  3. Click on the Create user data... dropdown and choose *From template
  4. Choose the template you want and click on Use this template. You can then edit its content.

From scratch

  1. Go to the dashboard and select a project
  2. Click on Project settings and then on the User data tab
  3. Click on the Create user data... dropdown and choose *From scratch


To make development easier, we provide variables that can be used on your user data script so you can access data that is only available during or right after a deployment.

Variables are wrapped in double curly brackets ({{ VAR }}). Here are the available variables that can be used by any user data script.

{{ HOSTNAME }}The normalized hostname.
{{ PASSWORD }}Root password of the deployed server.
{{ USER_DISTRO }}Distro username. Examples: ubuntu, centos, Admin.
{{ MAC_ADDRESS }}MAC Address.
{{ PUBLIC_IPV4 }}Public IPv4 address.
{{ SSH_KEYS }}An array of the SSH keys you chose to deploy your server with, if any.
{{ SERIAL }}Windows serial (only available for Windows systems).