What is a User-Data Script?

A User-data script is used by the cloud-init process run on every dply server when it's first launched. By providing a user-data script you can configure your server immediately on it's creation.

Examples

Install a LAMP (Linux, Apache, MySQL, PHP) stack on Ubuntu 16.04 (YAML)

#cloud-config
apt_update: true
packages:
  - apache2
  - php-mysql
  - mysql-server
  - libapache2-mod-php7.0
  - php7.0-mcrypt
  - php7.0-gd
  - php7.0-curl

Install a LAMP (Linux, Apache, MySQL, PHP) stack on Ubuntu 16.04 (Bash)

#!/bin/sh
export DEBIAN_FRONTEND=noninteractive;
apt-get update;
apt-get -y upgrade;
apt-get -y install apache2 php-mysql mysql-server libapache2-mod-php7.0 php7.0-mcrypt php7.0-gd php7.0-curl;

When your script is run, the output will be logged to /var/log/cloud-init-output.log so you can review the output and check for any issues.

You can also share your user-data script by creating a dply button. With this button, others can create a free server on dply running your custom code!