Using Templates
Templates in Shadeform allow you to save and reuse instance configurations, making it easy to launch instances with predefined settings like launch configurations, networking rules, and environment variables. Templates are particularly useful when you need to repeatedly deploy instances with the same configuration or share configurations with team members.
In this guide, we’ll cover how to create, use, and manage templates via the Shadeform API.
Prerequisites
There are two pre-requisites for this guide:
- After you have created your account, you must top up your wallet here.
- After you have topped up your wallet, generate and retrieve your Shadeform API key here.
Step 1: Create a Template
To create a new template, use the /templates/save
endpoint. You can define various configurations including launch settings, networking rules, and environment variables.
Example Response
Step 2: View Template Details
After creating a template, you can view its details using the /templates/{template_id}/info
endpoint. Use the id
from the response in Step 1. If you want to see templates you have created, use the /templates
endpoint.
Example Response
Step 3: Launch an Instance Using a Template
To use a template when creating an instance, include the template_id
in your instance creation request using the /instances/create
endpoint.
Example Response
Step 4: Delete a Template
When you no longer need a template, you can delete it using the /templates/{template_id}/delete
endpoint.
Summary
Templates provide a powerful way to standardize and automate your instance deployments.
For more details about template configurations and available options, check out the Templates API reference.