Skip to main content
User data
Last update:

User data

User data — user configuration parameters of the server operating system. Described as scripts in cloud-config format (text files with YAML syntax) or as a bash script. The scripts are automatically Base64 encoded, transferred to the server, and executed using the cloud-init agent when the operating system is first started. The use of user data helps automate the configuration of servers.

You can Specify user data when creating a cloud server.

For more information about cloud-config and bash script formats, see the User data formats instructions in the cloud-init documentation.

In scripts, you can pass parameters to configure the operating system and scripts. For example:

See other examples in the Cloud config examples cloud-init documentation.

Specify user data

You can only specify user data when cloud server creation:

  • in the control panel — at step 14 you can insert text in the User data field, upload a file in txt, gz, sh or MIME archive formats. The maximum size of a script with data that is not Base64 encoded is 16 KB;
  • via OpenStack CLI and Terraform — only scripts with Base64 encoded data.

Once the server is created, you cannot change the script.

Examples of user data

Create a directory and upload the files to it

An example script to create a directory and upload a file to it over the network:

- mkdir /run/newdir
- [ wget, "", -O, /run/newdir/index.html ]

Update repositories and install packages

Sample script to install pwgen and pastebinit:

package_update: true
- pwgen
- pastebinit

Place SSH keys on the server

Sample script:

- ssh-rsa AAAAB3N…V7NZ user1@host
- ssh-rsa AAAAB3N…NtHw== user2@server

Customize the configuration file

Sample script for the resolv.conf domain name resolver:

manage_resolv_conf: true
nameservers: ['', '']
rotate: true
timeout: 1