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 Cloud Compute instance using the Vultr Customer Portal, API, or CLI.
Navigate to Products and click Compute.
Click your target instance to open its management page.
Navigate to the User-Data tab.
Enter your script or cloud config in the Cloud-Init User-Data field and click Update to apply changes.
Send a GET
request to the List Instances endpoint and note the target instance's ID in your output.
$ curl "https://api.vultr.com/v2/instances" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a PATCH
request to the Update Instance endpoint to update the Cloud-Init user data on the instance.
$ curl "https://api.vultr.com/v2/instances/{instance-id}" \
-X PATCH \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
--data '{
"user_data" : "<cloud-init-data>",
}'
List all Cloud Compute instances available in your Vultr account and note the target instance's ID in your output.
$ vultr-cli instance list
Upload new Cloud-Init user data to the instance using a file on your workstation.
$ vultr-cli instance user-data set <instance-id> --userdata "<script-path>"