DigitalOcean Droplets are Linux-based virtual machines (VMs) that run on top of virtualized hardware. Each Droplet you create is a new server you can use, either standalone or as part of a larger, cloud-based infrastructure.
Metadata is a service that allows a Droplet to access data about itself. In addition, you can use Metadata to provide user data to Droplets at creation to simplify or automate setup.
User data is arbitrary data, most often a script, that you can supply to a Droplet during creation. If CloudInit is available on the Droplet, it will consume the user data, which it can use to perform tasks as the root user during the Droplet’s first boot.
cloud-config files or any script that can be interpreted by the new Droplet, like a Bash script. CloudInit is available on DigitalOcean’s latest Ubuntu and CentOS images. You can define user data for images that do not support CloudInit, but it will not be consumed automatically on first boot.
To provide user data when creating a Droplet via the DigitalOcean Control Panel, on the Droplet creation page, above the Finalize Details section, click + Advanced Options. In the section that opens, check the box next to Add Initialization scripts. Add your user data in the box that appears.
To provide user data when creating a Droplet via the DigitalOcean API, use the
user_data field in the Droplet creation POST request.
To provide user data when creating a Droplet via
doctl, the DigitalOcean CLI, use the
--user-data-file flags when calling
doctl compute droplet create.
You cannot modify user data after a Droplet is created.
To see how a CloudInit file uses the provided user data, view the
cat /var/log/cloud-init-output.log | grep userdata
The file logs output from CloudInits so you can view any warnings, error messages, or debug information.