Create, view, edit, and delete custom templates in the Agent Sandbox console. A template lets you quickly create sandbox instances by reusing its runtime, resource specifications, and image configuration.
Background
A custom template stores configurations such as the runtime, resource specifications, and image of a sandbox. Sandbox instances created from the same template reuse the same runtime environment without repeated configuration.
Templates can be created and managed in the Agent Sandbox console.
Go to the sandbox templates page
-
Log on to the Agent Sandbox console.
-
In the top navigation bar, select the target region.
-
In the left-side navigation pane, under Flash Edition, select the target Team.
-
Click Sandbox Templates to go to the template list.
In the template list of the Agent Sandbox console, search for existing templates by template name or ID.
Create a custom template
Fill in basic configurations
On the Sandbox Templates page, click Create Template and fill in the basic configurations.
|
Parameter |
Description |
|
Template name |
The name must start with a letter or a digit. The name can contain letters, digits, hyphens ( |
|
Sandbox runtime |
Select the first-generation or second-generation (MicroVM) runtime. The second-generation (MicroVM) runtime may be marked as Beta in the console. The available options depend on what the console displays. For more information about the differences between the two generations, see Differences between first-generation and second-generation sandbox runtimes. |
|
vCPU |
Select the number of CPU cores used by the sandbox. |
|
Memory |
Select the memory size used by the sandbox. Unit: GB. |
|
Disk |
Configure the disk size. Unit: GB. |
The vCPU, memory, and disk specifications that you set in a template determine the computing resources that sandbox instances created from the template consume and the fees that those instances incur. For more information, see Billing Overview.
For example, create a template named custom-base-2001, select the second-generation (MicroVM) runtime, and configure 4 vCPUs, 8 GB of memory, and 15 GB of disk space.
Configure the image
In the Image Configuration section, select the image source of the sandbox.
|
Image source |
Description |
|
Public image |
Select the required image from the image list provided in the console. Filter images by category, or search by image name. |
|
Custom image |
Switch to Custom Image, and fill in the image configuration as prompted on the page. |
The public image list displays the image name, sandbox category, and image version. For example, select Base Runtime as the base image of the template.
A custom template can also be created based on a public image. You do not need to prepare a custom image in advance.
Submit and check the build status
After you complete the configurations on the page, submit the template. On the template details page, view Build Status on the Basic Information tab.
When the build status is Ready, the template is available for creating sandbox instances.
View template details
In the template list, click a template name to go to the details page. The Basic Information tab displays the following information:
|
Category |
Included information |
|
Basic configurations |
Template name, template ID, owner Team, sandbox runtime, vCPU, memory, disk, and OS type. |
|
Status and time |
Build status, creation time, and update time. |
|
Image configuration |
Image address and image version. |
|
Template build configurations |
Build-related configurations such as the startup command. |
Edit a template
-
In the template list, click the name of the template that you want to modify.
-
In the upper-right corner of the details page, click Edit.
-
Adjust the template configurations. The edit page shows which fields can be modified.
-
Save the modifications, and then return to the details page to check the configurations and the build status.
Create a sandbox instance from a template
A sandbox instance created from a template consumes the vCPU, memory, and disk resources that the template specifies, and you are charged for these resources while the instance is active. A destroyed sandbox instance no longer incurs charges, so destroy the sandbox instances that you no longer use. For more information about the billing rules, see Billing Overview.
-
Open the details page of the target template, and confirm that the build status is Ready.
-
Click Create Sandbox Instance in the upper-right corner.
-
Create the sandbox instance from the template as prompted on the page.
-
View the creation result on the Sandbox Instances page.
Delete a template
-
In the template list, click the name of the template that you want to delete.
-
In the upper-right corner of the details page, click Delete.
-
Complete the deletion as prompted on the page.
Before you delete a template, confirm that your workloads no longer use this template to create new sandbox instances.