---
title: Cloud-Init
url: https://docs.vultr.com/products/compute/instances/bare-metal/features/cloud-init
description: A guide for modifying the automated initialization data on Vultr Bare Metal servers after deployment.
publish_date: 2024-09-23T20:20:32.197534Z
last_updated: 2026-05-26T18:50:37.054001Z
---

# How to Update Cloud-Init User Data on a Vultr Bare Metal Instance

Cloud-Init enables the automatic initialization and configuration of instances during the initial boot phase. Cloud-Init user data runs a specific script's contents to automate the instance customization, software installation and configuration of specific packages or services.

Follow this guide to update Cloud-Init user data on a Vultr Bare Metal instance using the Vultr Console, API, CLI, or Terraform.

=== "Vultr Console"

    1. Navigate to **Products** and click **Compute**.
    1. Click your target instance to open its management page.
    1. Navigate to the **User-Data** tab.
    1. Enter a script or cloud config in the **Cloud-Init User-Data** field. 
    1. Click **Update** to apply changes.

=== "Vultr API"

    1. Send a `GET` request to the [**List Bare Metal Instances** endpoint](https://www.vultr.com/api/#tag/baremetal/operation/list-baremetals) and note your target instance's ID.

        ```
        $ curl "https://api.vultr.com/v2/bare-metals" \
          -X GET \
          -H "Authorization: Bearer ${VULTR_API_KEY}"
        ```  

    1. Send a `PATCH` request to the [**Update Bare Metal** endpoint](https://www.vultr.com/api/#tag/baremetal/operation/update-baremetal) to update the Cloud-Init user data on the instance.

        ```console
        $ curl "https://api.vultr.com/v2/bare-metals/{baremetal-id}" \
          -X PATCH \
          -H "Authorization: Bearer ${VULTR_API_KEY}" \
          -H "Content-Type: application/json" \
          --data '{
            "user_data" : "<cloud-init-data>"
          }'
        ```

=== "Vultr CLI"

    1. List all Bare Metal instances available in your Vultr account and note the target instance's ID.

        ```console
        $ vultr-cli bare-metal list
        ```

    1. Upload new Cloud-Init user data to the instance using a file on your workstation.

        ```console
        $ vultr-cli bare-metal user-data set <instance-id> --userdata "<script-path>"
        ```

=== "Terraform"

    Cloud-Init user data can only be set during instance creation in Terraform and cannot be updated on an existing Bare Metal instance without recreating it.

    1. Open your Terraform configuration for the new Bare Metal instance.

    1. Add the `user_data` argument to the Bare Metal resource to run a script at first boot.

        ```terraform
        resource "vultr_bare_metal_server" "bm" {
            # ...existing fields (region, plan, label, etc.)

            user_data = <<-EOT
            #cloud-config
            packages:
              - nginx
            runcmd:
              - systemctl enable --now nginx
            EOT
        }
        ```

    1. Apply the configuration and observe the following output:

        ```
        Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
        ```
