Greenhost VPSs now support cloud-init

It is now possible to use cloud-init with our VPS's. Cloud-init scripts define what needs to be done immediately after a VPS is started for the first time. These files can be used to automate the setup of a VPS. This can range from small tasks — like configuring the machine or adding more users — to more complex tasks like installing software.

Cloud-init is a technology that is supported by many cloud providers. In addition to cloud-init scripts that you might find anywhere on the internet, Greenhost offers a repository with scripts that you can use to automate certain steps in setting up your VPSs. At the time of writing it contains scripts to install Jitsi, a video conferencing tool; Outline, a VPN service; and Yunohost, a web interface to manage your server and install cloud applications. We will add more scripts gradually and we encourage everyone to share scripts with us. Please open a Merge Request if you have anything to share!

You can find our cloud-init scripts at

How can I use cloud-init?

Our most up-to-date instructions will always be available in the cloud-init repository. To make it easy for you, we included the current instructions in this blog. Please read on.

First off, you need to create a new VPS. Do not re-use an already existing VPS, because cloud-init only installs things on the first boot.

If you do not have a Greenhost account yet, you need to order a VPS and create one here. If you already have an account, log in to the Service Centre and click the green button that says "New VPS" on the left side of the screen.

This screen shows you a few options to configure your VPS:

  • Configuration: our scripts include "Requirements" in the readme to advise you on the number of CPUs, memory and disk size. After your machine is in use, you can still change the amount of CPUs and memory. It is also possible to increase your disk size.
  • Disk size: pick your application's recommended disk size.
  • Software: pick your application's recommended operating system.
  • SSH Key: even if you won't have to log in to the VPS because cloud-init does everything, you need to set an SSH public key so you have access to the machine if that's necessary later.
  • Hostname: choose a hostname that describes your purpose for this machine.
    • Tip: if your hostname is a (sub)domain that you manage at Greenhost, you can choose to automatically generate an A record that points to this VPSs IP address.
  • Click "Advanced options" and insert your cloud-init script in the Userdata field.
  • Make sure Enable API is checked. This allows the cloud-init script to report back to the Service Centre when it's finished.
  • Click Create.

You will see a progress bar. After the progress bar has completed, the page will refresh and you will see a console. The console will show the progress of the cloud-init script. Check the of the scripts in this repository to see what you need to do after the cloud-init script has finished. For example, the script that installs Outline will also show some information above the console when it finishes.

You can do so much more

cloud-init is not only useful for easily installing applications to your VPS, it can be used for configuration as well, think about:

  • Setting the default locale
  • Installing your favourite software
  • Setting up ephemeral mount points
  • Creating additional users and adding their public SSH keys

In fact, the Service Centre accepts a "user-data" file. In this guide, we only covered #cloud-config files, but you can take a look at the cloud-init documentation for even more uses.

We would really like to know what you use cloud-init for. If you use it, please let us know via social media or an email!