Article

Table of Contents
Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $300 by adding new articles!

About Cloud-Init and Startup Scripts

Last Updated: Wed, Sep 16, 2020
FAQ

About Cloud-init

Cloud-init is an open-source project compatible with most Linux distributions. Cloud-init is designed to handle early initialization of a cloud instance and uses userdata to describe the cloud instance's configuration settings. When Cloud-init detects userdata, it applies the settings to the cloud instance.

Cloud-init is third-party software and is not supported by Vultr. See this article for more information about cloud-init issues. Vultr instances created before 2017 had this software installed by default. New deployments of our standard OS images do not include cloud-init. If you decide to install Cloud-init on your instance, please see the official cloud-init documentation.

About Startup Scripts and Userdata

We recommend using Vultr startup scripts instead of cloud-init. You can add startup scripts to an instance in the Vultr Control panel or with the Vultr API. Read more about startup scripts in our quickstart guide.

You can create userdata for startup scripts with the Vultr Metadata API when deploying a new instance. You can also update running instances. Userdata values are Base64 encoded. For example:

$ curl https://api.vultr.com/v1/server/set_user_data \
    -H 'API-Key: YOUR_API_KEY' \
    --data 'SUBID=YOUR_SUB_ID' \
    --data 'userdata=QmUgU3VyZSBUbyBEcmluayBZb3VyIE92YWx0aW5lLgo='

To retrieve the user data, use the /latest/user-data endpoint. The Base64 encoded value is decoded and returned as text.

# curl http://169.254.169.254/latest/user-data
Be Sure To Drink Your Ovaltine.

If you update a running instance, /latest/user-data will return old values until the instance is rebooted or reinstalled.

Want to contribute?

You could earn up to $300 by adding new articles