Getting Started With Cloud-Init

Last Updated: Wed, May 18, 2016

Cloud-init is an open source project compatible with most Linux distributions. Vultr instances created before 2017 had this software installed by default. The purpose of Cloud-init is to help handle early initialization of a cloud instance, which includes tasks such as disk-resizing and network configuration. Cloud-init also has a datasource feature (known as userdata) which describes configuration settings of the cloud instance to Cloud-init. When Cloud-init detects userdata, it applies the given settings to the cloud instance.

Please note, Cloud-init is third-party software and is not officially supported by the Vultr team. For simple configurations, we recommend using our startup script feature instead of custom Cloud-init data. Startup scripts can be added from within the Vultr Control panel. However, please note that cloud-init will not be installed on vultr instances you will be required to install these packages yourself.

If you decide to install Cloud-init on your instance, you may find the following examples helpful.

Cloud-init data examples

Cloud-init data can be specified when launching a Vultr cloud instance. Listed below are several example snippets. For more examples, see the official cloud-init documentation.

Write data to a file.

  - path: "/root/my_file.txt"
    permissions: "0644"
    owner: "root"
    content: |
      Here is some sample content.

Run a script after the system boots.

 - "/bin/echo sample > /root/my_file.txt"

Automatically upgrade packages on the system.

package_upgrade: true

Want to contribute?

You could earn up to $300 by adding new articles