When a server finally runs the way you want, you can keep its launch settings as a template of your organization and start the same setup again in a few clicks. The template gets the server's image and tag, launch mode, start script, ports, disk size (as the default disk), hardware needs and environment variables. The server itself is not touched, and it may be running or stopped. Owners and admins can do this.
Files on the server's disk are not part of a template. A new server from the template starts from the image, so keep data you need on a volume or copy it off first (see Fine-tune or train: keep your work safe).
1. Save the server as a template in the console
- Open Servers and select the server.
- Go to the Settings tab and select Save as template.
- Enter a Template name. It must differ from the names of your other templates.
- Select Save as template.
You see Template saved. You find it under Templates. If the server had secrets, the message lists their names instead: those still need a value (step 3).
Servers of a serverless endpoint or a server group cannot be saved this way.
2. The same from the CLI or the API
apidly servers
apidly templates save ins_ID --name "My setup" --summary "Fine-tuning setup that works"The command prints Saved server ins_ID as template tpl_… (slug). and, on the next line, the secrets to fill in, or No secret values to fill in. Without --name the server's label is used. A name has at most 60 characters and a summary at most 280. This needs a key with Full access created by an owner or admin.
Through the API:
curl -X POST https://apidly.com/api/v1/servers/ins_ID/template \
-H "Authorization: Bearer $APIDLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "My setup", "summary": "Fine-tuning setup that works"}'The answer is 201 with the template, secretsToFill and secretRefs. A name that is already taken answers 409 name_taken; choose another one.
3. The secret rule: values are never copied
A template is easy to share inside your organization, so secret values never go into it:
- Plain values are copied as they are.
- Every secret, whether it came from the template or was added at launch, and every plain variable whose name looks like a key, token or password, is saved by name with an empty value. These names are listed in
secretsToFilland in the console message. - A value that points at your secrets store (
secret:NAME) is kept as that reference, so the template keeps reading the stored secret. These are listed insecretRefs. - Variables the platform sets for each server, such as the browser-terminal password and the self-stop key, are left out.
- Values are copied only when you launched the server yourself or your role may manage every server. Otherwise every variable is saved by name with an empty value, the start script is the source template's own, and the API answer says
"valuesCopied": false.
Fill in each empty secret before you use the template: edit the template under Templates and enter the value, or enter it on the configure step when you launch. To avoid typing it again, store it in your secrets store and use secret:NAME as the value (see Secrets).
4. Launch a server from your template
In the console, open Templates, find your template and select Deploy with this. Pick a GPU, check the price and deploy as usual.
From the CLI, use the slug that templates save printed:
apidly templates --own
apidly deploy --plan PLAN_SLUG --template YOUR_TEMPLATE_SLUG --label from-template --dry-run
apidly deploy --plan PLAN_SLUG --template YOUR_TEMPLATE_SLUG --label from-template --waitThe first command lists your own templates. The second shows the price without starting anything (see Check the price before you launch). The third deploys after asking Deploy? [y/N].
What it costs and how to stop spending
Saving a template costs nothing: it keeps settings, not a disk. Servers you launch from it are billed by the second like any other server. Stop one with apidly stop ins_ID (the disk is still charged) or destroy it with apidly destroy ins_ID. Deleting the template later does not affect servers that already use it.
Next
Ready to try it?
Create a free account and add credit when you want to start a server. The smallest top-up is $10.
Was this helpful?