# How to Provide User Data During Droplet Creation 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. User data is arbitrary data, often a script, that you can supply to a Droplet during creation. \[[cloud-init](https://cloud-init.io/)]([https://cloud-init.io/](https://cloud-init.io/)) is a tool that applies user data to automatically configure cloud servers like Droplets. When you provide user data to a Droplet with cloud-init, cloud-init consumes the user data, which it can use to perform tasks as the root user during the Droplet’s first boot. This is helpful for automation setup for tasks like creating new users, customizing firewall rules, installing applications, and configuring SSH keys. ## About cloud-init cloud-init accepts [`cloud-config` files](https://www.digitalocean.com/community/tutorials/an-introduction-to-cloud-config-scripting) or any script that can be interpreted by the Droplet, like a Bash script. cloud-init is available on DigitalOcean’s latest Ubuntu and CentOS images. You can define user data for images that do not support cloud-init, but the user data is not consumed automatically on first boot. ## Providing User Data You can provide user data to a Droplet during creation via the [DigitalOcean Control Panel](https://cloud.digitalocean.com), the [API](https://docs.digitalocean.com/reference/api/reference/droplets/index.html.md#droplets_create), or [`doctl`, the CLI client](https://docs.digitalocean.com/reference/doctl/reference/compute/droplet/create/index.html.md). - To provide user data when creating a Droplet via the DigitalOcean Control Panel, on the [Droplet creation page](https://cloud.digitalocean.com/droplets/new), 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` or `--user-data-file` flags when calling [`doctl compute droplet create`](https://docs.digitalocean.com/reference/doctl/reference/compute/droplet/create/index.html.md). You cannot modify user data after a Droplet is created. ## Debugging User Data To see how a cloud-init file uses the provided user data, view the `/var/log/cloud-init-output.log` file: ```bash cat /var/log/cloud-init-output.log | grep userdata ``` The file logs output from cloud-init so you can view warnings, error messages, and debug information. ## More Information cloud-init has both [reference documentation](https://cloudinit.readthedocs.io/en/latest/topics/modules.html) and [examples](https://cloudinit.readthedocs.io/en/latest/topics/examples.html) to see which properties of your Droplet you can automatically configure upon deployment. [an introduction to cloud-config scripting](https://www.digitalocean.com/community/tutorials/an-introduction-to-cloud-config-scripting): this tutorial explains the format and usage of `cloud-config` files, which are special scripts designed to be run by the `cloud-init`process for initial configuration on the first boot of a server. [how to use cloud-config for your initial server setup](https://www.digitalocean.com/community/tutorials/how-to-use-cloud-config-for-your-initial-server-setup): this tutorial uses the digitalocean metadata service and `cloud-config` files to automate initial server setup for a ubuntu droplet.