How to Update Cloud-Init User Data on a Vultr Cloud GPU Instance
-
by Blog Admin
- 15
How to Update Cloud-Init User Data on a Vultr Cloud GPU Instance
A guide for updating the Cloud-Init user data on your Vultr Cloud GPU instance after deployment.
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 GPU instance using the Vultr Customer Portal, API, CLI, or Terraform.
Vultr Customer Portal
- 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.
- Click Update to apply changes.
Vultr API
- Send a
GET
request to the List Instances endpoint and note the target instance’s ID in your output.console$ 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.console$ 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>", }'
Vultr CLI
- List all instances available in your Vultr account and note the target instance’s ID.
console
$ vultr-cli instance list
- Upload new Cloud-Init user data to the instance using a file on your workstation.
console
$ vultr-cli instance 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 instance without recreating it.
- Open your Terraform configuration for the new Cloud GPU instance.
- Add the
user_data
argument to the instance resource to run a script at first boot.terraformresource "vultr_instance" "gpu" { # ...existing fields (region, plan, os_id, label, etc.) user_data = <<-EOT #!/bin/bash apt-get update -y apt-get install -y nginx systemctl enable --now nginx EOT }
- Apply the configuration and observe the following output:
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
How to Update Cloud-Init User Data on a Vultr Cloud GPU Instance A guide for updating the Cloud-Init user data on your Vultr Cloud GPU instance after deployment. 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…
How to Update Cloud-Init User Data on a Vultr Cloud GPU Instance A guide for updating the Cloud-Init user data on your Vultr Cloud GPU instance after deployment. 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…