Create a DSW instance

Updated at:

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.

      The following table describes the GPU models and corresponding instance families supported by DSW:

      GPU model

      Instance family

      Example specifications

      NVIDIA A10

      gn7i

      ecs.gn7i-c8g1.2xlarge, ecs.gn7i-c16g1.4xlarge, ecs.gn7i-c32g1.8xlarge, ecs.gn7i-c32g1.16xlarge

      NVIDIA L20

      gn8is

      ecs.gn8is.2xlarge, ecs.gn8is.4xlarge, ecs.gn8is.2x.8xlarge, ecs.gn8is.4x.16xlarge

      GPU H (96 GB of GPU memory)

      gn8v

      ecs.gn8v.4xlarge, ecs.gn8v.6xlarge, ecs.gn8v.2x.8xlarge, ecs.gn8v.2x.12xlarge, ecs.gn8v.4x.8xlarge, ecs.gn8v.4x.24xlarge

      NVIDIA V100

      gn6v/gn6e

      -

      NVIDIA T4

      gn6i

      -

      NVIDIA P100

      gn5

      -

      GU100

      gn7e

      -

      NVIDIA Quadro RTX6000

      ebmgn6g

      -

      Note

      DSW does not support GPU instances of the H100 or H800 model.

    • 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

Q: DSW instance fails to start

Troubleshooting: Click the instance name and check the error message 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 resource type is out of stock in this region.

    • Solution: Try again later, or switch to a different resource 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 at most 2 GPU instances per region at a time. Selecting a resource type with more than 2 GPUs will fail.

    • Solution: To raise your quota, submit a ticket.

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

    • Cause: When a VPC vSwitch is configured, the resource search is limited to the availability zone of that vSwitch, which may result in resource shortages.

    • Solution:

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

      2. Try 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.

    Resource sales in the specified availability zone are suspended. Try the following:

    • Switch to a different region.

    • Select a different resource type.

    • Try starting the instance 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 system released the instance due to prolonged account arrears.

    • Solution: Create a new instance.

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

    • Cause: Free-tier resources are shared. During peak hours, starting a DSW instance may take more than 30 minutes. If the system can't acquire resources within one hour, it reports the selected type as unavailable in the current region.

    • Solution: Try the following:

      • Switch to a different region.

      • Change the resource type (pending instances don't support type changes — stop the instance manually first, then switch).

      • Use the instance during off-peak hours, such as outside business hours.

      • If none of the above works, contact your account manager.

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

    • Cause: All compute resources in the cluster are in use.

    • Solution: Try the following:

      • Switch to a different region.

      • Change the resource type (pending instances don't support type changes — stop the instance manually first, then switch).

      • Use the instance during off-peak hours, such as outside business hours.

      • If none of the above works, 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 resource type is sold out.

    • Solution: Try the following:

      • Switch to a different region.

      • Change the resource type (pending instances don't support type changes — stop the instance manually first, then switch).

      • Use the instance during off-peak hours, such as outside business hours.

      • If none of the above works, contact your account manager.

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

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

      To check system disk usage: click the instance name in the DSW instance list, go to the details page, and check the System disk status in the Environment information section.

    • Solution: In the instance list, click Change Settings to expand the system disk.

      Important

      After expanding the system disk, billing continues regardless of whether the instance is running. To stop all DSW-related charges, delete the instance. Back up your data before deleting.

  • Pod was active on the node longer than the specified deadline

    • Cause: This error is typically raised by the underlying ACK layer. Common causes include incorrect configuration of parameters inside the container, or the system disk running low on free space.

    • Solution: Follow these troubleshooting steps:

      1. Check whether the custom image contains abnormal configuration.

      2. Run find / -type f -print0 | xargs -0 du -h | sort -rh | head -n 10 to identify the largest files on the system disk and confirm whether they are expected business files.

      3. Confirm network connectivity between CPFS and the DSW instance, and verify that the VPC configuration is consistent.

  • found multiple security groups with the same name

    • Cause: This is typically caused by a backend anomaly.

    • Solution: Try restarting the instance. If the error persists, record the request ID from the error message and submit a ticket for investigation.

  • Instance fails to start due to CPU resource fragmentation on the node

    Solution: Adjust the startup order of your tasks — stop some DSW instances that are occupying resources first, start the target instance, and once it starts successfully, restart the other tasks.

  • Q: My custom image doesn’t have an IDE installed — can I still use the web-based IDE?

    Yes. The VS Code and other IDE tools built into the DSW web console are part of the platform’s built-in environment and don’t depend on any IDE package included in your custom image.

  • Startup failed: Workspace member not found

    Your account is not a member of the target workspace. Contact your workspace administrator to add your account as a 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 check the System disk status in the Environment information section. Click Expand to expand the system disk. Note that expanding the system disk incurs additional storage charges.

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

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

    1. Account arrears: The account has unpaid balances, and the system blocked new resource creation requests. Even free-tier resource types can't be created while the account is in arrears.

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

    Troubleshooting steps:

    1. Log in to the Billing and Cost console to check for unpaid balances. If there are arrears, pay them before retrying.

    2. If the account has no arrears, risk control may be the cause. Submit a ticket with the Request ID from the error message, and technical support will help 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 type, or switch to another region and availability zone.

  • RISK.RISK_CONTROL_REJECTION

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

    Solution:

    1. Confirm that real-name verification is complete for the account.

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

    3. If you still can't create an instance, submit a ticket.

Other startup failure causes:

  • Account arrears

    If your account is in arrears, DSW instance creation will fail. Vouchers cannot offset arrears. Log in to the Billing and Cost console to check your account balance.

DSW instance stop and release

Q: How do I release a DSW instance?

In the DSW instance list, use the Stop or Delete actions in the right-hand operation column.

Important: If you expanded the system disk, it continues to incur storage charges even when the instance is stopped. To stop all DSW-related billing, delete the instance.
Q: I can't find my DSW instance — what should I do?

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 stop all DSW billing? What's the difference between "Stop" and "Delete"?
  • Stop: Releases the compute resources (CPU/GPU) and pauses compute charges. Note: An expanded system disk continues to incur charges.

  • Delete: Permanently deletes the instance and all its resources, including the system disk. All related billing stops completely.

When to choose:

  • Stop: You're temporarily done but want to keep your data and environment for a future restart.

  • Delete: You no longer need the instance and want to stop all billing. Back up your data before proceeding.

Q: My DSW instance has been in "Stopping" or "Deleting" state for a long time — what's happening?

When you stop a DSW instance, the system automatically builds an image cache by saving the current container read-write layer, which speeds up the next startup. This is expected behavior, not a system failure. If a large amount of data was written to the container layer, the cache build takes longer — potentially from several minutes up to a few hours.

Important

DSW instances created in the shared resource group don't incur compute charges while in "Stopping", "Saving", or "Deleting" state.

If the instance takes a long time to stop, common causes include:

  • 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 layer size and extend stop time.

  • A process inside the instance didn't terminate cleanly.

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

Tips to speed up stopping:

  • Before stopping, use the Save image feature to set exclusion paths for large files or directories you don't need to save (such as model files and datasets). This can significantly reduce stop time. For details, see the topic on saving DSW instance images.

  • Store large data in a mounted OSS or NAS path rather than on the system disk. This fundamentally reduces the container read-write layer size.

  • If you don't need the instance and don't care about preserving data, Delete it to release resources immediately.

If stopping is taking too long, wait patiently. If it hasn't completed after 2 hours, submit a ticket for technical support.

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 resource group type.

  • Stop instance:

    Data retention depends on the resource group type.

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

    • Instances using Temporary Storage as the system disk: data is stored in ephemeral storage. Stopping the instance deletes the data and it cannot be recovered.

  • Delete instance:

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

Q: Why did my running DSW instance stop automatically?

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

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

  • Recommendations:

    • Stop manually: to reliably save resources, stop the instance manually when you're not using it. The auto-shutdown policy isn't guaranteed to trigger every time.

    • Modify the policy: for long-running tasks, modify or disable this policy. Steps:

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

      2. Find the DSW configuration section. Here you can modify the DSW shutdown policy and exclusion policy. For example, to disable auto-shutdown for specific instances, add them to the exclusion policy by instance name.

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

Check the following common causes:

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

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

  • Billing is delayed. Billing isn't real-time — charges generated in the morning may not appear in your bill until the afternoon.

Q: Can I use an API, Python code, or a post-task trigger to automatically stop a DSW instance?

The following automatic control methods aren't supported:

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

  • Running a shutdown command from within the instance using Python code, such as os.system.

  • Setting the instance to stop automatically after a task completes.

DSW supports only the idle auto-shutdown policy (minimum idle duration: 1 hour), which determines idle state based on CPU/GPU utilization. This policy can't guarantee 100% trigger reliability. 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.