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

Updated on November 27, 2024

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 Customer Portal, API, or CLI.

  • Vultr Customer Portal
  • Vultr API
  • Vultr CLI
  1. Navigate to Products and click Compute.

    Vultr Customer Portal

  2. Click your target instance to open its management page.

    View active instance subscriptions

  3. Navigate to the User-Data tab.

    Access the DDoS Tab

  4. Enter a script or cloud config in the Cloud-Init User-Data field and click Update to apply changes.

    Update Cloud-Init user data

  1. Send a GET request to the List Bare Metal Instances endpoint and note your target instance's ID.

    $ curl "https://api.vultr.com/v2/bare-metals" \
      -X GET \
      -H "Authorization: Bearer ${VULTR_API_KEY}"
  2. Send a PATCH request to the Update Bare Metal endpoint 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>"
      }'
    
  1. List all Bare Metal instances available in your Vultr account and note the target instance's ID.

    console
    $ vultr-cli bare-metal list
    
  2. 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>"