All Products
Search
Document Center

Platform For AI:Manage Instant Service instances

Last Updated:Aug 28, 2026

An instance is an isolated runtime environment created from a template. You can create instances from the console or SDK, and perform operations such as terminal access, VNC desktop, file management, service invocation, pause and resume, save as template, and expiration reclamation on the instance details page.

Overview

An instance is the lowest layer in the PAI-Instant Service three-tier resource hierarchy (space > template > instance). Each instance:

  • Runs in isolation: has its own guest OS kernel, file system, and access credentials.

  • Has an independent lifecycle: can be created, paused, resumed, and deleted independently.

  • Has unique properties: includes an instance ID, Access Token, file system, access URL, and service ports.

Note

For the full three-tier resource model, see Instant Service overview — Resource hierarchy.

Usage notes

For persistent connections longer than 24 hours, connection stability isn't guaranteed.

Create an instance

Create from the console

PAI-Instant Service provides three console entry points for creating instances:

  1. Entry point 1: On the instant service workbench, click the Create Instance button.

  2. Entry point 2: In the Private Templates/Public Templates list, select the Create Instance action for the target template.

  3. Entry point 3: On the template details page, click Create Instance in the instance list.

In the Create Instance dialog box, configure the following parameters:

Parameter

Required

Description

Template

Yes

The template to base the instance on.

Expiration time

Yes

The maximum time-to-live for the instance, such as 1 hour. Turn on the Never Expires toggle to disable expiration (not recommended for production).

Environment variables

No

Environment variables visible inside the instance, in key-value format.

Custom tags

No

Key-value tags for the instance, useful for searching and categorizing.

Click Create Instance to create the instance.

Create with the SDK

PAI-Instant Service is natively compatible with the E2B SDK. The usage is the same as E2B:

import os
from e2b import Sandbox

# Set authentication credentials
os.environ["E2B_API_KEY"] = "<YOUR-TOKEN>"
os.environ["E2B_DOMAIN"] = "sandbox01.cn-shanghai.pai-eas.aliyuncs.com"

# Create an instance
sandbox = Sandbox.create(
    template="<YOUR-TEMPLATE-ID>",
    timeout=300000,
)

print(f"Sandbox ID: {sandbox.sandbox_id}")          

On the Template Details page, click SDK Access in the upper-right corner to view the SDK connection configuration and Python sample code. For more API details, see E2B SDK integration.

Use an instance

View instance details

Go to the instant service workbench, find the target instance in the instance list, and click Details in the Actions column to open the instance details page.

The instance details page displays:

  • Resource specifications: CPU, memory, and disk.

  • Status information: status (Running/Paused) and uptime.

  • Basic information: instance ID, template, creation time, expiration time, RAM user ID, Alibaba Cloud account ID, and Access Token.

  • Metadata: key-value pairs such as sandbox.alicloud.com/service-name and userId.

Open a terminal

Click Open Terminal to open a Web Terminal window. The terminal displays the instance ID, template ID, and session timeout (10-minute idle timeout and 30-minute maximum by default).

Run any shell command directly in the terminal. This is equivalent to calling sandbox.commands.run() through the SDK, and is useful for debugging and verifying your environment.

Open VNC

For Desktop-type templates, click Open VNC to start a remote desktop session.

Note

The noVNC service must listen on port 6080. The frontend redirects to this port for remote desktop access.

VNC is useful for:

  • Debugging applications that require a graphical interface.

  • Visual verification of browser automation (such as Playwright and Selenium).

  • GUI testing and screenshot capture.

Manage files

The instance details page provides a File Management panel with a directory tree view:

  • Browse the directory structure inside the instance, such as bin, boot, code, dev, etc, and home.

  • Create folders, upload files, refresh the view, navigate up one level, and return to the root directory.

  • View file sizes and modification times.

File management is equivalent to calling sandbox.files.read() / sandbox.files.write() through the SDK, and lets you quickly access runtime results without leaving the console.

Invoke services

The Service Invocation panel provides an HTTP interaction interface for calling services running inside the instance.

Configuration options:

  • Request method: GET, POST, PUT, DELETE, and more.

  • Port: the listening port of the service inside the instance.

  • Path: the URL path for the request, such as /health.

  • Request headers: custom HTTP headers, such as Content-Type: application/json.

  • Preview URL: the full request URL assembled by the system, which you can copy and use directly.

Click Send Request. The HTTP Interaction History panel on the right displays the request and response content for real-time debugging.

Important

External access to instance services: Services running inside the instance automatically get a publicly accessible URL in the format https://<port>-<sandbox-id>.<domain>/<path>. Call this URL directly from any HTTP client without additional port mapping.

View request logs

Switch to the Request Logs tab to view all HTTP requests forwarded to the instance through the data plane. Use these logs for auditing and troubleshooting.

Pause and resume

You can pause and resume instances to preserve their state for later recovery or to save them as templates.

  • Pause: Click Pause in the instance list or call sandbox.pause(). The instance state is persisted to the instance storage.

  • Resume: Click Resume in the instance list or call Sandbox.connect("<sandbox-id>"). The instance quickly recovers to the running state.

Important

A paused instance continues to be billed at the same rate as a running instance (including CPU, memory, and system disk). To reduce costs, delete instances that are no longer in use. For details, see Billing.

Save as a template

You can save the current state of an instance, including files, installed dependencies, and running processes, as a new template for environment reuse.

Typical scenarios:

  • After completing code changes and environment configuration during development, save the instance as a template to avoid rebuilding the image for every change.

  • Capture a fully configured agent runtime environment as a standard template for team reuse.

Prerequisites: The instant service must have a configured Enterprise Edition Image Instance (Standard or Enterprise Edition).

Procedure:

  1. Pause the instance that you want to save as a template.

  2. Click Save as Template.

  3. Enter a name and description for the new template.

  4. Click OK. The system creates a new template based on the current instance state.

Note

The new template appears in the Private Templates list of the instant service workbench.

Instance expiration and reclamation

Instances are reclaimed through the following mechanisms:

  • Automatic destruction when the expiration time specified at creation is reached.

  • Manual deletion through the console or SDK.

Extend instance timeout

You can extend the timeout in two ways:

Method

Behavior

Sandbox.connect(timeout=...)

Extends the timeout when reconnecting. If the instance is paused, it resumes automatically with the new timeout. If running, the timeout extends only when the requested timeout exceeds the remaining time.

sandbox.set_timeout(N)

Explicitly sets a new timeout. Resets the expiration to the current time plus the specified timeout value.

What's next