Create a DSW instance

更新时间:
复制 MD 格式

DSW (Data Science Workshop) provides a cloud-based IDE for AI development. Developers familiar with Notebook or VS Code can start model development immediately. This topic covers how to create a DSW instance and how to resolve common issues that occur when starting or releasing instances.

Quick start

  1. Log in to the PAI console, select the target Region, click Workspaces, and go to the target workspace.

  2. In the left navigation pane, choose Interactive Modeling (DSW)> Create Instance. Configure the following key parameters and leave the others as default. For all parameters, see Console parameter reference.

    Parameter

    Description

    Instance Name

    Example: dsw_test.

    Resource Type

    Select Public Resources, which uses pay-as-you-go billing.

    Instance Type

    Select a specification such as ecs.gn7i-c8g1.2xlarge (1 A10 GPU, 8 vCPUs, 30 GiB memory).

    If this specification is out of stock, try another specification in the list or switch to a different region.
    Warning
    • If you're using a DSW free trial resource voucher, make sure the selected specification is within the supported range (ecs.g6.xlarge, ecs.gn7i-c8g1.2xlarge, or ecs.gn6v-c8g1.2xlarge). Selecting an unsupported specification will prevent the voucher from being applied. For details, see Claim, use, and release free trial resources.

    • When the free quota is used up or expires, if the DSW instance is still running, the system automatically switches to pay-as-you-go billing and deducts fees from your account balance. Release the instance promptly to avoid unexpected charges.

    Image config

    Select Alibaba Cloud Image, then search for and select modelscope:1.31.0-pytorch2.8.0-gpu-py311-cu124-ubuntu22.04 (Python 3.11, CUDA 12.4).

    ModelScope images include a broad set of built-in third-party libraries and are compatible with most AI development workflows.

    Click OK to create the instance. When the instance status changes to Running, the instance is created successfully.

    If the instance fails to start, see DSW instance startup .
  3. On the DSW instance list page, click Open under the Actions column to open the DSW instance and start developing your model.

    For details on the DSW instance interface, and how to stop, release, or modify a DSW instance, see Access and manage DSW instances.

    Important
    • For DSW instances created using public resources, billing starts the moment the instance status changes to Running—even if you don't open the web-based IDE or run any code.

    • Closing the browser or logging out doesn't stop the instance or pause billing.

    • If you're using a free trial resource voucher, the system automatically switches to pay-as-you-go billing after the quota runs out. The instance won't stop automatically.

  4. Stop the instance. When you've finished your development work and no longer need the DSW instance, go back to the DSW instance list page:

    • To pause the instance temporarily, click Stop. If the system disk has been expanded, storage charges for the system disk continue even after the instance is stopped.

      Important

      By default, data is stored on a free cloud disk. If the instance is stopped for more than 15 days, the cloud disk contents are cleared and cannot be recovered. Instances with an expanded system disk are not subject to this limit.

    • To permanently delete the instance, click More> Delete. This stops all billing. Back up any important data before deleting, as deleted data cannot be recovered.

    Important

    DSW pay-as-you-go bills are generated hourly with a 2–3 hour delay. After stopping or deleting an instance, you may still receive charge notifications for a few hours for usage incurred before the action. This is normal billing behavior and doesn't indicate duplicate charges.

Typical use case configurations

The default DSW instance configuration may not meet all AI development requirements. The following table summarizes configurations for common scenarios:

Scenario

Challenge

Configuration

Reference

Persistent code and data storage

The DSW instance system disk is temporary—data is cleared when the instance is deleted or stopped for an extended period. You need long-term storage for important files, or to share data across multiple instances.

Mount cloud storage (such as Object Storage Service (OSS)) to a specific directory in the instance using Dataset Mounting or Mount storage.

Mount a dataset, OSS, NAS, or CPFS

Faster public internet download speeds

The DSW instance uses a shared gateway by default, which limits bandwidth. This can slow down large file downloads.

In the network settings, configure a Virtual Private Cloud (VPC) and use Private Gateway. You also need to create a NAT gateway and an EIP (elastic IP address) for the VPC.

Improve internet access with a private gateway

SSH-based remote development

You prefer using local tools such as VS Code or PyCharm for development and debugging, and don't want to be limited to the web-based IDE.

In the access settings, enable Enable SSH, fill in SSH Public Key, and select Access over Internet. Associate an existing NAT gateway and EIP.

Remote connection: Direct SSH connection

Accessing web services inside the instance

You want to expose a web app running in the instance to the internet so it can be accessed or shared via URL.

In the access settings, add a Custom Services, configure the service port, and enable public access. You must also add an inbound rule in the security group to allow traffic on that port.

Access services in an instance over the public network

Console parameter reference

Basic information

Parameter

Description

Instance Name

Configure the instance name following the prompts on the page.

Tag

Add labels to instances for multi-dimensional resource discovery, grouping, batch operations, and cost allocation.

Resource information

Parameter

Description

Resource Type

  • Public Resources: Pay-as-you-go billing. Cannot be converted to subscription (annual/monthly) billing.

    Note

    GPU card limit: When using public resources, each Alibaba Cloud account (main account) is limited to 2 GPU cards per region. Exceeding this limit may cause errors. To increase the limit, submit a ticket.

    • Instance Type: Choose from GPU, CPU, or free trial specifications. For specification details, see Instance family overview.

      Warning
      • If you're using a DSW free trial resource voucher, make sure the selected specification is within the supported range (ecs.g6.xlarge, ecs.gn7i-c8g1.2xlarge, or ecs.gn6v-c8g1.2xlarge). Selecting an unsupported specification will prevent the voucher from being applied. For details, see Claim, use, and release free trial resources.

      • When the free quota is used up or expires, if the DSW instance is still running, the system automatically switches to pay-as-you-go billing and deducts fees from your account balance. Release the instance promptly to avoid unexpected charges.

    • Bidding Purchase: Use a preemptible instance to reduce running costs. If No preemptible instances in stock is shown, try a different specification.

      This parameter is currently supported in the following regions: China (Hangzhou), China (Shanghai), China (Beijing), China (Ulanqab), China (Shenzhen), China (Guangzhou), Japan (Tokyo), and Singapore.

    • Driver Settings: Set the driver version for GPU instances using public resources. Supported major driver versions vary by GPU type.

  • Resource Quota: Subscription (annual/monthly) billing.

    • Resource Quota: Choose from general computing resources or Lingjun computing resources. If no resources are available, click Associate Resource Quota to configure.

    • Instance Type: Set the GPU, CPU, and memory based on your requirements.

    • Priority: Priority ranges from 1 to 9. A higher value indicates higher priority.

    • Idle Resources: The task can run on idle resources in the current or other quotas under the account, improving resource utilization. When those resources are needed by the original quota's tasks, the idle-time task is terminated and resources are returned automatically. Save your environment and data regularly during development.

      • Acceptable: The task can use idle compute resources from the current or other quotas under the account.

      • Only: The task uses only idle resources under the account and doesn't consume its own quota.

    • Node-Specific Scheduling: Select a specific node for creating the DSW instance.

    • CPU Affinity: Bind processes in a container or Pod to specific CPU cores. This reduces CPU cache misses and context switches, improving CPU utilization and application performance. Suitable for performance-sensitive and real-time workloads. Currently supported only in China (Beijing) and China (Shenzhen).

    • Driver Settings: Set the driver version for GPU instances using Lingjun computing resource quotas. Supported major driver versions vary by GPU type.

Environment information

Parameter

Description

Image Configuration

The following image types are supported:

  • Alibaba Cloud Image: PAI provides official images for common open-source frameworks and Python versions. For example, pytorch:2.4.1-gpu-py312-cu124-ubuntu22.04 indicates PyTorch 2.4.1, for GPU instances, Python 3.12, and CUDA 12.4.

    To find a specific version, search by keyword in the search box. For example, search cu124 to find images with CUDA 12.4.

  • Custom Image: Use a custom image that has been added to PAI. The image repository must be set to public pull access, or the image must be stored in Container Registry (ACR). For details, see Custom images.

  • Image Address: Supports custom or official image addresses accessible over the public internet.

    • To improve image pull speed, see Image acceleration.

    • For private image addresses, click Enter username and password and configure the repository credentials, or temporarily set the repository to public pull access.

System Disk

Used for storing files during development. When Resource Type is set to Public Resources, or when Resource Quota uses a subscription general computing resource (at least 2 CPU cores and 4 GiB memory, or with GPU), each instance includes a free 100 GiB cloud disk as the system disk. The disk can be expanded; see the console for pricing.

Warning
  • If you use only the free cloud disk, the disk contents are cleared if the instance is stopped for more than 15 days.

  • After expanding the disk, the entire cloud disk (free + paid) is no longer subject to the 15-day stop-and-clear rule. However, the expanded portion incurs continuous charges until the instance is deleted.

  • Disk expansion cannot be reversed. Expand only as needed.

  • The cloud disk is released when the instance is deleted. Back up important data before deleting.

For persistent storage, configure Dataset Mounting or Mount storage.

Dataset Mounting

Store datasets for reading, or persist files generated during development. The following dataset types are supported:

  • Custom Dataset: Create a custom dataset to store training data files. Supports read-only access and version selection.

  • Public Dataset: PAI provides pre-configured public datasets. Only read-only mount mode is supported.

Mount Path: The path where the dataset is mounted in DSW, for example /mnt/data. Access this path in your code to retrieve dataset files.

Note
  • Multiple datasets cannot share the same mount path.

  • If a CPFS dataset is configured, network configuration is required, and the selected VPC must match the CPFS VPC. Otherwise, the DSW instance may fail to create.

  • When a dedicated resource group is selected, the first dataset must be a NAS dataset and will be mounted to both the path you specified and the default DSW working directory /mnt/workspace/.

For more details on mounting, see Mount a dataset, OSS, NAS, or CPFS.

Mount storage

Mount storage to read datasets or persist files generated during development.

For more details on mounting, see Mount a dataset, OSS, NAS, or CPFS.

Enable Multi-Container Isolation (DinD)

When enabled, you can create multiple isolated sub-containers within the current instance. Suitable for multi-user DSW instance sharing. For details, see Sub-container management (DockerBoard).

Working Directory

Available when public resources are selected. The working directory is the startup path for Notebook and the web-based IDE, and defaults to /mnt/workspace.

More configurations

Parameter

Description

Custom Startup Script

Run custom scripts during instance startup to configure the environment or perform initialization tasks. The script runs after the image and resources are ready, but before development applications such as JupyterLab and Code Server start.

Note
  • 3-minute timeout: Custom scripts increase instance startup time. The timeout is 3 minutes—don't use scripts for long-running tasks such as image downloads.

  • Script run logs: After the instance starts, find the script logs under /var/log/user-command/.

Environment Variable

Applied to the main container startup, system processes, and user processes. Add custom environment variables or override system defaults as needed.

Note: Avoid modifying the following environment variables:

# Changes will not take effect
USER_NAME # This will be overwritten by the logic in the service

# System variables that should not be modified, as changes may affect normal operation
JUPYTER_NAME: Defaulted to a value constructed from instance information; can be used to modify the URL access path for JupyterLab.
JUPYTER_COMMAND: The command to start Jupyter; defaulted to "lab" to launch JupyterLab.
JUPYTER_SERVER_ADDR: The listening address for the JupyterLab service; defaulted to 0.0.0.0.
JUPYTER_SERVER_PORT: The listening port for the JupyterLab service; defaulted to 8088.
JUPYTER_SERVER_AUTH: The access password for JupyterLab; defaulted to empty.
JUPYTER_SERVER_ROOT: The working directory for Jupyter; has lower priority than WORKSPACE_DIR.
CODE_SERVER_ADDR: The listening address for the code-server service; defaulted to 0.0.0.0.
CODE_SERVER_PORT: The listening port for the code-server service; defaulted to 8082.
CODE_SERVER_AUTH: The access password for code-server; defaulted to empty.
WORKSPACE_DIR: This environment variable is set based on the workspace directory parameter configured when the instance is created. It can change the startup directory for Jupyter and code-server. An error may occur if the specified path does not exist.

Advanced Configurations

Advanced configuration lets you adjust kernel parameters required for certain workloads. Currently supported only for Lingjun resource group instances. For parameter details, see the table below.

Advanced configuration parameter

Description

Example value

VmMaxMapCount

Sets the maximum number of memory-mapped regions a process can have. Default value: 65530. Values below 65530 have no effect; excessively high values may waste memory.

1024000

EnableNvidiaIBGDA

Enables IBGDA when loading the GPU driver. Required for DeepEP.

true

EnableNvidiaGDRCopy

Installs the GDRCopy kernel module (version 2.4.4). Required for DeepEP.

true

VpmuFeature

Enables asys CPU hotspot analysis capabilities. Valid values: 0, 1, 2. Default: 0 (disabled); 1 (partial); 2 (full). Enabling VPMU may have a performance impact—enable only as needed.

2

EnableVcpuTier

Enables the RunD CPU pinning optimization. Default: false. This allows RunD vCPUs to be scheduled to available CPU cores promptly by the kernel, but may cause scheduling contention and HyperThread interference. The following conditions must also be met:

  1. The instance must be a full-card instance (no other instances or tasks on the node).

  2. CPU count >= 4 × GPU count.

  3. CPU count must be an even number.

true

VcpuTierHighCPU

Manually specifies HighCPU after EnableVcpuTier is enabled. If not specified, defaults to the number of GPUs per worker (for example, 8 or 16). The value must be in the range [GPU count, CPU count / 2).

4

Network information

Parameter

Description

VPC Settings

Available only when Resource Type is set to Public Resources.

To use a DSW instance within a VPC, create a VPC in the same region as the DSW instance and configure this parameter. You must also configure vSwitch and Security Group. For configuration strategies for different scenarios, see Network configuration.

vSwitch

Available when a VPC is configured. A vSwitch is a subnet within the VPC. Your DSW instance and other cloud resources connect through the vSwitch.

Security Group

Required when a VPC is configured. The security group acts as a virtual firewall for the DSW instance, controlling all inbound and outbound network traffic.

Internet Access Gateway

The following configuration methods are supported:

  • Public Gateway: The public gateway has bandwidth limitations that may not meet requirements during high concurrency or large file downloads.

  • Private Gateway: To work around public gateway bandwidth limits, create a public NAT gateway in the DSW VPC, associate an EIP, and configure SNAT entries. For details, see Improve internet access with a private gateway.

The following parameter is available only when Mount Configuration uses a CPFS dataset:

  • Enable all options: Disabled by default. When disabled, the system disables VPCs that are incompatible with CPFS datasets.

Note

If a CPFS dataset is selected in the mount configuration, VPC configuration is required, and the VPC must match the CPFS VPC.

Extended CIDR Block

Available after vSwitch is configured. Use an extended CIDR block to expand VPC address space when the available IP addresses are insufficient for growing workloads, or when initial network planning didn't allocate enough addresses. For more details, see Secondary CIDR blocks.

Access configuration

Parameter

Description

Enable SSH

Enables remote SSH access to the instance. Available after a VPC is selected. When enabled, a Custom Services named SSH appears. If using a custom image, make sure sshd is installed.

SSH Public Key

Available after the SSH Configuration toggle is enabled.

Note

To support both VPC-based and public internet login, add public keys for multiple clients. Add keys one per line (pressing Enter between each). Up to 10 public keys are supported.

Service Access and Port Configuration

Used for configuring SSH remote access or Access services in an instance over the public network.

  • Listener Port: The port that the service running in the DSW instance listens on.

  • Service Access Method:

    • Access over VPC: Supported by default. Access services in the DSW instance from other endpoints within the VPC (such as ECS).

    • Access over Internet: Select this option to add public internet access. You must also configure NAT Gateway and EIP.

  • Internet Access Port: The port exposed for public internet access.

Create Private Zone in VPC

Create a Private Zone (authoritative internal domain name) to access the instance's SSH service or other custom services within the VPC using a fixed domain name, instead of tracking a changing instance IP. Note: creating a Private Zone incurs charges. For pricing, see Alibaba Cloud DNS pricing.

Public Network Access

NLB:

  • NLB Instance Resource Group: Select the resource group where the NLB instance resides.

  • NLB Instance: Select the NLB instance in the same VPC as the DSW instance.

DNAT + EIP:

  • NAT Gateway: Maps public internet requests (EIP:port) to the private DSW instance (private IP:port).

  • EIP: Provides the public IP address for accessing services in the instance over the internet.

Roles and permissions

Parameter

Description

Visibility

Select Visible to the Instance Owner or Visible to Current Workspace.

Instance Owner

Only workspace administrators can change the instance owner.

Show More

Parameter

Description

Instance RAM Role

Associate a RAM role with a DSW instance to access other cloud resources from within the instance. This approach uses Security Token Service (STS) temporary credentials, eliminating the need to configure long-term AccessKeys and reducing the risk of credential leakage.

The instance RAM role can be configured as:

  • Default Roles of PAI: Grants access to PAI internal products, MaxCompute, and OSS. Temporary credentials issued under this role grant the same permissions as the DSW instance owner when accessing PAI products and MaxCompute tables, and only allow access to the default storage bucket configured for the current workspace when accessing OSS.

  • Custom Roles: Configure a custom role when you need fine-grained or customized permission management.

  • Does Not Associate Role: Select no role when you want to access other cloud products directly using an AccessKey.

For more details on instance RAM role configuration, see Configure a RAM role for a DSW instance.

FAQ

DSW instance startup

Click to expand

Q: DSW instance fails to start

Troubleshooting: Click the DSW instance name and check the error details on the Events tab.

Common errors and solutions:

  • Your requested resource type [ecs.] is not enough currently, please try other regions or other resource types

    • Cause: The selected instance type is out of stock in this region.

    • Solution: Try again later, or switch to a different instance type or region.

  • Your resource usage has exceeded the default limitation. Please contact us via ticket system to raise the limitation.

    • Cause: Each Alibaba Cloud account (primary account) can create a maximum of 2 GPU cards per region at a time. Selecting an instance type with more than 2 GPU cards causes the creation to fail.

    • Solution: Submit a ticket to request a quota increase.

  • the available zone with vSwitch is out of stock or InternalError-ResourceAllocateFailed

    • Cause: When a VPC vSwitch is specified during instance creation, the resource search is limited to the availability zone of that vSwitch. If resources in that zone are exhausted, creation fails.

    • Solution:

      1. Create a vSwitch and DSW instance in a different availability zone.

      2. Switch to a different DSW instance type.

  • Sales of this resource are temporarily suspended in the specified zone. We recommend that you use the multi-zone creation function to avoid the risk of insufficient resource.

    Resources in the specified zone are temporarily unavailable. Try the following:

    • Switch to a different region.

    • Change the instance type.

    • Retry during off-peak hours.

  • CommodityInstanceNotAvailableError:Commodity instance has been released due to prolonged arrears at past. Please create a new instance for use

    • Cause: The instance was automatically reclaimed due to an extended period of overdue payment.

    • Solution: Create a new instance.

  • The charge of current ECI instance has been stopped, but the related resources are still being cleaned.

    • Cause: Trial resources are shared public resources. During peak periods, starting a DSW instance may take over 30 minutes. If resources cannot be allocated within one hour, the system reports that the selected instance type is unavailable in the current region.

    • Solution: Try the following:

      • Switch to a different region.

      • Change the instance type (instances in a pending state don't support type changes — stop the instance first, then change the type).

      • Retry during off-peak hours (outside of business hours).

      • If none of these steps resolve the issue, contact your account manager.

  • The cluster resources are fully utilized. Please try later or other regions.

    • Cause: All compute resources in the current cluster are occupied.

    • Solution: Try the following:

      • Switch to a different region.

      • Change the instance type (instances in a pending state don't support type changes — stop the instance first, then change the type).

      • Retry during off-peak hours (outside of business hours).

      • If none of these steps resolve the issue, contact your account manager.

  • Create ECI failed because the specified instance is out of stock. It is recommended to use the multi-zone creation function to avoid the risk of stockout.

    • Cause: The specified compute resource is sold out.

    • Solution: Try the following:

      • Switch to a different region.

      • Change the instance type (instances in a pending state don't support type changes — stop the instance first, then change the type).

      • Retry during off-peak hours (outside of business hours).

      • If none of these steps resolve the issue, contact your account manager.

  • back-off 10s restarting failed container=dsw-notebook pod

    • Cause: The system disk is full and needs to be expanded.

    Check system disk usage: Click the instance name in the DSW instance list, go to the details page, and view the System disk usage in the Environment information section.

    • Solution: In the instance list, click Change configuration on the right to expand the system disk.

    Important: After the system disk is expanded, it continues to incur storage charges regardless of whether the instance is running. To stop all charges for a DSW instance, delete the instance. Back up all necessary data before deleting.
  • Startup failed: Workspace member not found

    This error means the account you're logged in with is not a member of the target workspace. Contact your workspace administrator to add your account as a workspace member.

  • failed to create containerd container: failed to prepare layer from archive: failed to validate archive quota ...

    • Cause: The image used to create the instance is too large, causing insufficient system disk space.

    • Solution: Click the instance name in the DSW instance list, go to the details page, and view System disk usage in the Environment information section. Click Expand to increase the system disk capacity. Note that expanding the system disk incurs additional charges based on the capacity.

  • Resource Error: create order error (status code 400)

    Cause: This error is typically caused by one of the following:

    1. Account overdue: The account has an outstanding balance. The system blocks new resource creation requests. Even if you select a free trial type, no instance can be created while the account is overdue.

    2. Account risk control: The account triggered Alibaba Cloud's risk control policy (for example, a newly registered account or unusual account activity), and the creation request was rejected.

    Troubleshooting steps:

    1. Log in to the Billing and Cost Management console and check whether the account has an overdue balance. If so, clear the balance and retry.

    2. If the account has no overdue balance, the issue may be caused by risk control restrictions. Submit a ticket and include the Request ID from the error message so that technical support can investigate and lift the restriction.

  • InternalError-Failed to perform action, error: OperationDenied.NoStock: The resource is out of stock in the specified zone. Please try other types, or choose other regions and zones.

    Resources in the specified availability zone are temporarily out of stock. Try a different instance type or switch to another region and availability zone.

  • RISK.RISK_CONTROL_REJECTION

    Cause: The account triggered Alibaba Cloud's risk control policy, and the instance creation or order request was rejected. Common triggers include: newly registered accounts that haven't completed verification, accounts with security risks, or unusual account activity.

    Solution:

    1. Confirm that the account has completed real-name verification.

    2. Log in to the Alibaba Cloud console and check for any notifications or alerts from Security Center.

    3. If instance creation still fails, submit a ticket.

Other startup failure causes:

  • Overdue account

    If your account has an overdue balance, DSW instance creation fails. Vouchers cannot offset an overdue balance. Log in to the Billing and Cost Management console to check whether your account has an outstanding balance.

Q: Resource type out of stock or compute quota insufficient

Common errors:

  • "Your requested resource type [ecs.] is not enough currently" (resource out of stock).

  • "Your resource usage has exceeded the default limitation" (2 GPU card limit per region exceeded).

  • "The cluster resources are fully utilized" (all compute resources occupied).

Analysis:

  • Public resource shortage

    • Public resources are shared among multiple users and may run short during peak periods.

    • Certain GPU types (such as high-end GPUs) sell out more quickly.

    • Each account is limited to 2 GPU cards per region.

  • Dedicated resource quota exhausted

    • Dedicated resource quota was purchased but is fully consumed.

    • Quota is unevenly distributed, leaving some workspaces with insufficient quota.

Solutions:

  • Switch instance type: If the current GPU type is out of stock, try a different GPU type.

  • Switch region: Use the region switcher in the upper-left corner of the PAI console to select a different region.

  • Request a GPU quota increase: To use more than 2 GPU cards from the public resource pool, submit a ticket.

  • Purchase dedicated resources: For stable resource availability, purchase dedicated resource quota. For details, see Purchase general compute resources and Manage resource quota.

Q: Can a Python script run automatically when a DSW instance starts?

Set the Custom startup script parameter when creating a DSW instance or when changing the instance configuration.

This feature lets you customize the environment or run initialization tasks during startup. The script runs after the image and resources are ready, but before JupyterLab, Code Server, and other development applications start.

Note
  • Timeout is 3 minutes: Custom scripts increase startup time. The script timeout is 3 minutes. Don't run long-running tasks such as image downloads in a custom script.

  • Script logs are available: After the instance starts, find custom script logs at /var/log/user-command/.

Q: What should I do if the DSW page is unresponsive or behaves abnormally?

If you encounter a white screen, a Notebook that keeps loading, a Terminal that won't accept input, or browser errors such as "504 Gateway Timeout" or "504 Timeout," the issue is usually related to your local environment or the instance state. Try the following steps:

  1. Clear your browser cache and retry.

  2. Open the page in a private or incognito browser window.

  3. Switch to a different network, such as a mobile hotspot instead of a corporate network, to rule out firewall restrictions.

  4. Try a different browser, such as Chrome or Firefox.

  5. If the error is a 504 Timeout, stop and restart the DSW instance from the PAI console, then wait for the status to change to Running before accessing it again.

Q: Does stopping, restarting, changing the type, or changing the image of a DSW instance with a cloud disk system disk cause data loss?

DSW instances with a cloud disk system disk include instances created in the public resource group and general-resource instances with Cloud disk selected as the system disk. Data retention behavior differs by operation:

  • Stop instance: Data may be lost. If the cloud disk was not expanded and the instance has been stopped for more than 15 days, the data is cleared and cannot be recovered. If the cloud disk was expanded or the instance has been stopped for 15 days or less, data is retained.

  • Restart instance: No data loss. After the instance is stopped or restarted, all packages installed via pip, code files, and other data stored on the system disk are preserved.

  • Change instance type: No data loss. Adjusting the instance type (CPU, memory, GPU, and other resource configurations) doesn't affect data on the system disk.

  • Change instance image: Data may be partially lost. Changing the image doesn't affect mounted datasets or data in OSS storage, but the system disk contents may be reset. Back up instance data before changing the image — for example, copy or move data to a dataset or OSS. For details, see Mount datasets, OSS, NAS, and CPFS.

For general-resource instances using Temporary storage as the system disk, stopping, restarting, changing the type, or changing the image always results in system disk data loss, regardless of whether the resource group has prepaid cloud disks.

Q: Can data be recovered from a DSW instance created with public resources that was released after 15 days without login?

For DSW instances created with public resources, if the cloud disk system disk was not expanded with a paid upgrade and the instance was not started for 15 or more consecutive days after being stopped, the system disk is automatically cleared and cannot be recovered.

Q: DSW instance startup is taking longer each time

Progressively longer startup times are likely caused by a large saved custom image.

Q: Why is the first startup of a DSW instance slower than subsequent startups?

The first time you start a DSW instance, the system pulls the full image, which can take 10 minutes or more depending on image size and network conditions. Subsequent startups are faster because the image is cached.

If startup time is increasing with each launch, the saved custom image may have grown too large. Clear unnecessary files and re-save the image, or switch to a lightweight official image.

Q: DSW instance creation fails with "out of stock" or "InternalError-ResourceAllocateFailed," or startup fails when SSH or a public IP is configured but succeeds without those settings. What's the cause?

This error is typically caused by insufficient resources in the availability zone of the specified VPC vSwitch. When a VPC and vSwitch are specified during DSW instance creation, the system limits resource scheduling to the availability zone of that vSwitch. If that zone is out of stock, instance creation fails. The root cause is insufficient resources in that specific availability zone, not a conflict with the network configuration.

Common error messages:

  • out of stock

  • InternalError-ResourceAllocateFailed

  • Startup fails when SSH access or a public IP is configured, but succeeds after removing those settings.

Solution: Switch to a vSwitch in an availability zone that has resources available. Create vSwitches in multiple availability zones under the same VPC to increase scheduling success rates.

Q: What should I do if a DSW instance can't restart after being stopped? How do I check when public resource stock will be replenished?

Public resource inventory updates daily and doesn't support querying specific replenishment times. When a DSW instance is manually stopped, the underlying compute resources are released. Restarting the instance is equivalent to requesting resources again — if the original instance type is occupied by other users at restart time, the instance may fail to start.

Solution:

  • Switch to a different region.

  • Switch to a different available instance type.

  • Retry during off-peak hours.

Q: DSW instance creation fails with "Private zone service status is not OPENED." What should I do?

This error means the Alibaba Cloud DNS PrivateZone service hasn't been activated. DSW relies on PrivateZone to initialize VPC network resolution.

Solution:

  1. Log in to the Alibaba Cloud console, search for Alibaba Cloud DNS PrivateZone, and activate the service.

  2. Confirm that the VPC used by DSW is associated with the PrivateZone service.

  3. Recreate or restart the DSW instance to trigger network initialization.

Q: DSW instance creation fails with "Workspace member not found" or "Workspace not exists." What should I do?

This error is typically caused by one of the following:

  • The current account is not a member of the target workspace.

  • The wrong workspace was selected.

Solution:

  • Switch to the correct workspace.

  • Contact the workspace administrator to add your account as a workspace member.

DSW instance stop and release

Click to expand

Q: How do I release a DSW instance?

In the DSW instance list, click Stop or Delete in the Actions column on the right.

Note: If the system disk was expanded when creating the DSW instance, it continues to incur storage charges regardless of whether the instance is running. To stop all charges for the DSW instance, delete the instance.

Q: Why can't I find my DSW instance?

If you can't find the instance, try switching to a different region or workspace.

Q: How do I release a free trial credit package?

Free trial credit packages don't need to be released or stopped.

Q: How do I completely stop billing for a DSW instance? What's the difference between Stop and Delete?
  • Stop instance: Releases the instance's compute resources (CPU/GPU) and pauses compute charges. Note: An expanded system disk continues to incur storage charges.

  • Delete instance: Permanently deletes the instance and all its resources, including the system disk. All associated charges stop completely.

When to use each option:

  • Stop: Temporarily not using the instance but want to keep the data and environment for a future restart.

  • Delete: No longer needed and want to stop all charges. Back up your data before proceeding.

Q: Why is my DSW instance stuck in "Stopping" or "Deleting" status for a long time?

When a DSW instance stops, the system automatically builds an image cache by saving the current container read-write layer data to speed up the next startup. This is expected behavior. If a large number of files or large amounts of data were written to the container read-write layer, the cache build takes longer and may last tens of minutes to several hours.

Important

DSW instances created in a public resource group don't incur compute charges while in "Stopping," "Saving," or "Deleting" status.

Common causes of a prolonged stop operation:

  • Large container read-write layer: This is the most common cause. Installing many packages, downloading model files, or saving datasets to the system disk all increase the read-write layer size and extend stop time.

  • Processes inside the instance haven't terminated normally.

  • High memory usage is preventing the instance from responding to the shutdown command.

Tips to speed up the stop operation:

  • Before stopping the instance, use the Save image feature to set exclusion paths for large files or directories that don't need to be saved (such as model files and datasets). This can significantly reduce stop time. For details, see the DSW instance image creation guide.

  • Store large data on mounted OSS or NAS paths instead of on the system disk. This keeps the container read-write layer small by design.

  • If the instance is no longer needed and you don't care about retaining data, delete the instance to immediately release resources.

If the instance is taking too long to stop, wait patiently. If the operation hasn't completed after 2 hours, submit a ticket for technical support assistance.

Q: Will my data and code be lost after stopping or deleting a DSW instance?

Whether data is retained depends on the operation and the instance's resource group type.

  • Stop instance:

    Data retention behavior varies by resource group type.

    • Instances with a cloud disk system disk (most pay-as-you-go types and general-resource instances with Cloud disk selected as the system disk): If the cloud disk was not expanded and the instance has been stopped for more than 15 days, data is cleared and can't be recovered. If the cloud disk was expanded or the instance has been stopped for 15 days or less, data is retained.

    • Instances using Temporary storage as the system disk: Data is stored in temporary storage. Stopping the instance deletes the data and it can't be recovered.

  • Delete instance:

    All data on the system disk is permanently erased and cannot be recovered. Back up all important data before deleting.

Q: Why does my running DSW instance stop automatically?

The instance has an idle auto-stop policy configured. This policy is designed to save resources and is enabled by default for free trial instances.

  • Trigger condition: CPU and GPU utilization remain below the configured threshold for 3 consecutive hours.

  • Recommendations:

    • Stop manually: To reliably save resources, stop the instance manually when it's not in use. The auto-stop policy isn't guaranteed to trigger every time.

    • Modify the policy: For long-running tasks, modify or disable the auto-stop policy. To do so:

      1. Go to the workspace details page and click Workspace settings > Scheduling settings.

      2. Find the DSW configuration section. Here you can modify the DSW auto-stop policy and exclusion policy. For example, to prevent a specific instance from being auto-stopped, add it to the exclusion policy by instance name.

Q: I've stopped or deleted all DSW instances, but they still show as "Running" or I'm still receiving billing notifications. Why?

Check the following common causes:

  • Confusing resource packages with instances. The "Running" status you see may refer to a resource package (such as "250 compute hours per month"), not an instance. Resource packages remain active throughout their validity period, regardless of instance status.

  • The expanded system disk is still being charged. Stopping an instance only pauses compute charges. An expanded system disk continues to incur storage charges.

  • Billing delays. Charges aren't processed in real time — bills may appear several hours after resource usage. For example, charges from the morning may not appear in your bill until the afternoon.

Q: Is it possible to automatically stop a DSW instance via API, Python code, or after a task completes?

The following methods of automatically controlling DSW instance start and stop are not supported:

  • Starting a training process or controlling instance start/stop from external environments such as ECS via API calls is not supported.

  • Running shutdown commands inside the instance via Python code (such as os.system) is not supported.

  • Setting the instance to auto-stop after a task completes is not supported.

DSW only supports an idle auto-stop policy (minimum idle duration of 1 hour). This policy determines whether an instance is idle based on CPU/GPU utilization, but it can't guarantee 100% triggering. Stop the instance manually after your task completes to avoid unexpected charges.

DSW instance free trial

For information about claiming, using, and releasing DSW free trial resources, see Claim, use, and release free trial resources.

Appendix: Create an instance using the Python SDK

  1. The Alibaba Cloud SDK uses the Credentials tool to retrieve credentials. Install and configure the tool before calling any API. Requirements:

    • Python 3.7 or later.

    • Alibaba Cloud SDK V2.0 generation.

    Run the following command to install:

    pip install alibabacloud_credentials
  2. Get your account AccessKey. This example uses AccessKey credentials. To prevent credential leakage, configure your AccessKey as environment variables. Use ALIBABA_CLOUD_ACCESS_KEY_ID for the ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET for the secret.

  3. Install the PAI-related Python SDKs.

    # Install workspace SDK.
    pip install alibabacloud-aiworkspace20210204 -U -q
    # Install DSW SDK.
    pip install alibabacloud_pai_dsw20220101 -U -q
    # OpenAPI dependency.
    pip install alibabacloud_tea_openapi -U -q
    # Install prepaid resource group query SDK.
    pip install https://sdk-portal-us-prod.oss-accelerate.aliyuncs.com/downloads/u-b8602de7-c468-436c-8a02-2eca4a30d376-python-paistudio.zip -U -q
  4. Create a DSW instance.

    Code example for creating an instance

    import os
    
    from alibabacloud_aiworkspace20210204.client import Client as AIWorkspaceClient
    from alibabacloud_aiworkspace20210204.models import (ListWorkspacesRequest,
                                                         ListImagesRequest)
    from alibabacloud_credentials.client import Client
    from alibabacloud_credentials.models import Config
    from alibabacloud_pai_dsw20220101.client import Client as DSWClient
    from alibabacloud_pai_dsw20220101.models import (GetInstanceRequest,
                                                     ListEcsSpecsRequest,
                                                     CreateInstanceRequest)
    from alibabacloud_tea_openapi.client import TeaException
    from alibabacloud_tea_openapi.models import Config as AliyunConfig
    
    # Configure access credentials.
    # The Alibaba Cloud account AccessKey has full access to all APIs. We recommend using a RAM user for API access and routine O&M.
    # Avoid storing your AccessKey ID and AccessKey Secret in project code to prevent credential leaks that could expose all resources in your account.
    # This example uses the Credentials SDK to read the AccessKey from environment variables for authentication.
    region_id = 'cn-beijing'  # Region. Can be cn-hangzhou, cn-shanghai, cn-shenzhen, and so on.
    config = Config(
        type='access_key',
        access_key_id=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID'),
        access_key_secret=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET'),
    )
    cred = Client(config)
    # Client configuration.
    workspace_client = AIWorkspaceClient(
        config=AliyunConfig(
            credential=cred,
            region_id=region_id,
            endpoint="aiworkspace.{}.aliyuncs.com".format(region_id),
        )
    )
    dsw_client = DSWClient(
        config=AliyunConfig(
            credential=cred,
            region_id=region_id,
            endpoint='pai-dsw.{}.aliyuncs.com'.format(region_id),
        )
    )
    
    # Define a helper function to display DSW instance information.
    def show_instance(instance_id):
        instance = dsw_client.get_instance(instance_id=instance_id, request=GetInstanceRequest()).body
        print(instance.status, instance.instance_name, instance.ecs_spec, instance.accumulated_running_time_in_ms)
    
    # Query the properties and ID of an existing workspace.
    workspace_name = 'Name of your AI workspace'
    # Retrieve the list of workspaces.
    workspaces = workspace_client.list_workspaces(ListWorkspacesRequest(
        page_number=1,
        page_size=10,
        workspace_name=workspace_name,  # Fuzzy match. If no name is specified, all workspaces are returned.
    ))
    if len(workspaces.body.workspaces) == 0:
        raise RuntimeError('Specify a valid workspace_name.')
    for workspace in workspaces.body.workspaces:
        print(workspace.workspace_name,
              workspace.workspace_id,
              workspace.status, workspace.creator)
    # Use the first result as the working workspace for subsequent operations. You can switch to a different one or specify a string-type ID directly.
    workspace_id = workspaces.body.workspaces[0].workspace_id
    # Retrieve the list of images. You can filter by labels.
    images = workspace_client.list_images(ListImagesRequest(
        page_size=100,
        # workspace_id=workspace_id, # Omitting workspace_id queries all built-in PAI platform images.
        labels=','.join(['system.supported.dsw=true',
                         # 'system.framework=tensorflow', # Specify pytorch or tensorflow.
                         'system.pythonVersion=3.6',
                         ]),
        verbose=True  # verbose=True returns detailed information including labels.
    ))
    # View all available images.
    for image in images.body.images:
        print(image.image_id, image.image_uri)
    # Retrieve the image to use for submitting tasks. The first image is used as an example here.
    image_uri = images.body.images[0].image_uri
    print('image_uri', image_uri)
    # Retrieve the list of DSW node specifications.
    try:
        resp = dsw_client.list_ecs_specs(ListEcsSpecsRequest(accelerator_type='CPU',  # CPU or GPU
                                                             )).body
    except TeaException as t:
        print("List ECS Specs failed:", t.message)
    else:
        for spec in resp.ecs_specs:
            print(spec.instance_type + ", CPU: " + str(spec.cpu) + ", Memory: " + str(spec.memory))
        # Retrieve the node specification to use for submitting tasks.
        ecs_spec = resp.ecs_specs[0].instance_type
        print('Selected ecs_spec:', ecs_spec)
    
    # Create a DSW instance.
    request = CreateInstanceRequest(instance_name="Test_From_SDK_1",
                                    ecs_spec=ecs_spec,
                                    workspace_id=workspace_id,
                                    # image_id='', # You can specify an image ID from the workspace, but it is mutually exclusive with image_url.
                                    image_url=image_uri)
    try:
        ins_resp = dsw_client.create_instance(request)
    except TeaException as t:
        print('Failed to create instance. Error message: ' + t.message)
    else:
        instance_id = ins_resp.body.instance_id
        print("Created Instance ID:", instance_id)
        show_instance(instance_id)

For information about additional APIs, see API overview.