Create a Vultr instance from a reusable template with optional cluster association. The template defines the plan, OS, SSH keys, and startup script.
Creating an instance using a template provisions a new server with the predefined configuration from the template, including the plan, OS, SSH keys, and startup script. You can optionally associate the instance with an existing cluster by providing a cluster_id.
This guide explains how to create an instance using an instance template via the Vultr API.
Send a GET request to the List Instance Templates endpoint to retrieve all available templates. If you do not have a template, create one by following How to Create an Instance Template.
$ curl "https://api.vultr.com/v2/instances/templates" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Note the id of the template you want to use.
Send a POST request to the Create Instance endpoint to create a new instance using the template. Replace REGION with the region identifier, TEMPLATE-ID with the template id, INSTANCE-LABEL with a descriptive label, SCRIPT-ID with the startup script id, and USER-DATA with base64-encoded Cloud-Init user data. To associate the instance with a cluster, include CLUSTER-ID.
$ curl "https://api.vultr.com/v2/instances" \
-X POST \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"region": "REGION",
"template_id": "TEMPLATE-ID",
"label": "INSTANCE-LABEL",
"hostname": "HOSTNAME",
"script_id": "SCRIPT-ID",
"user_data": "USER-DATA",
"cluster_id": "CLUSTER-ID"
}'
A successful request returns an HTTP 202 Accepted response with the instance details. Note the instance id for future operations.
Send a GET request to the Get Instance endpoint to retrieve the instance details. Replace {instance-id} with the id from the previous step.
$ curl "https://api.vultr.com/v2/instances/{instance-id}" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Verify that the instance status progresses to active and the configuration matches the template.