CreateInstance

Updated at:

Creates a DSW instance.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

POST /api/v2/instances HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The instance properties.

AccessRestrictionRules

object

No

The instance access restriction rules.

string

No

The configuration values for the instance access restriction rules.

PAI.AlgoOperator,PAI.AlgoDeveloper,PAI.LabelManager,PAI.WorkspaceGuest,PAI.MaxComputeDeveloper

Accessibility

string

No

The visibility of the instance.

Valid values:

  • PUBLIC :

    Visible to all users in the workspace.

  • PRIVATE :

    Visible only to the owner and administrators in the workspace.

PRIVATE

Affinity

object

No

The affinity configuration information.

CPU

object

No

The CPU affinity configuration information. Only general-purpose subscription instances are supported.

Enable

boolean

No

Specifies whether to enable CPU affinity. Valid values:

  • false: Disabled.

  • true: Enabled.

true

AssignNodeSpec

object

No

The specified node scheduling configuration.

AntiAffinityNodeNames

string

No

The nodes excluded from scheduling, such as node-a,node-b.

node-b

NodeNames

string

No

The specified nodes for scheduling, such as node-a,node-b.

node-a

CloudDisks

array<object>

No

The list of cloud disks.

[]

array<object>

No

The list of cloud disks.

Capacity

string

No

When Resource Type is set to Public Resources, or when Resource Quota is set to upfront general-purpose compute resources (with at least 2 CPU cores and 4 GB of memory, or configured with a GPU):

Each instance includes a free 100 GiB system cloud disk quota for persistent storage. If the instance remains stopped for more than 15 days, the data on the cloud disk is cleared. You can expand the capacity of the cloud disk. For pricing details, refer to the console interface.

Warning
  • You cannot reduce the capacity after expansion. Expand the capacity only as needed.

  • After expansion, the entire system cloud disk (including both free and paid portions) is no longer released after being stopped for 15 days, but it continues to incur fees.

  • When an instance is deleted, its system cloud disk is released in synchronization. Ensure necessary data backup before deletion.

For permanent storage, configure Dataset Mounting or add OSS, NAS, or CPFS paths in Storage Path Mounting.

100Gi

MountPath

string

No

The mount path of the cloud disk.

/mnt/systemDisk

Path

string

No

The subpath of the cloud disk mounted to the instance.

workspace

Status

object

No

The usage status of the cloud disk or snapshot.

Available

integer

No

The available capacity, in bytes.

31841058816

Capacity

integer

No

The total capacity, in bytes.

32212254720

Usage

integer

No

The used capacity, in bytes.

371195904

SubType

string

No

The cloud disk type. Valid values:

  • rootfs: Mounted as the system cloud disk. The system environment is stored on the disk.

rootfs

CredentialConfig CredentialConfig

No

The credential configuration.

Datasets

array<object>

No

The list of datasets.

object

No

The dataset.

AccessPointId

string

No

The access point ID of BMCPFS (CPFS for AI). This is used for fine-grained access control based on access points. It must be specified together with RoleArn and takes effect only on Lingjun resources.

ap-bp15victorick1132*****

DatasetId

string

No

The dataset ID. If the dataset is read-only, you cannot change it to read/write by using MountAccess.

For information about how to obtain the dataset ID, see ListDatasets. You cannot specify both DatasetId and Uri.

d-vsqjvs****rp5l206u

DatasetVersion

string

No

The dataset version. DatasetId must be specified at the same time. If you do not specify this parameter, the default value is v1.

v1

Dynamic

boolean

No

Specifies whether dynamic mounting is enabled. Default value: false.

  • Currently, only instances that use general-purpose compute resources are supported.

  • Currently, only OSS datasets are supported, and the mounted datasets are in the read-only pattern.

  • The MountPath of a dynamically mounted dataset must be a subpath of the dynamic mounting root path (default: /mnt/dynamic/), such as /mnt/dynamic/data1/.

  • Dynamically mounted datasets must be placed after non-dynamically mounted datasets.

true

EnableCache

boolean

No

Specifies whether to enable local cache acceleration for the dataset. If this parameter is not passed or is set to false, the feature is disabled. If it is set to true, the feature is enabled. This parameter takes effect only when the resource to which the instance belongs is connected to the cache service.

true

MountAccess

string

No

The read and write permission after the dataset is mounted. If the dataset is read-only, you cannot change the permission to read and write.

Valid values:

  • RW :

    Read and write.

  • RO :

    Read-only.

RW

MountPath

string

No

The mount path of the dataset.

/mnt/data

OptionType deprecated

string

No

[Deprecated] The mount type. You cannot specify Options at the same time. This parameter is deprecated. We recommend that you use the Options parameter instead.

ReadOnly

Options

string

No

The custom mount attributes. Currently, only OSS is supported. You cannot specify OptionType at the same time. For more information, see DSW mount configurations.

{ "fs.oss.download.thread.concurrency": "10", "fs.oss.upload.thread.concurrency": "10", "fs.jindo.args": "-oattr_timeout=3 -oentry_timeout=0 -onegative_timeout=0 -oauto_cache -ono_symlink" }

RoleArn

string

No

The ARN of the RAM role used for dataset mounting. For OSS datasets, it is used for fine-grained access control. For BMCPFS (CPFS for AI), it is required when AccessPointId is specified for mounting.

acs:ram::1234567890123456:role/aliyunossmountrole

Uri

string

No

The URI of the storage service directory for direct mounting. This field is mutually exclusive with DatasetId.

For the URI formats of different storage types, see the following examples:

  • OSS: oss://bucket-name.oss-cn-shanghai-internal.aliyuncs.com/data/path/

  • NAS: nas://29**d-b12****446.cn-hangzhou.nas.aliyuncs.com/data/path/

  • Extreme NAS: nas://29****123-y**r.cn-hangzhou.extreme.nas.aliyuncs.com/data/path/

  • CPFS: cpfs://cpfs-213****87.cn-wulanchabu/ptc-292*****cbb/exp-290********03e/data/path/

  • CPFS for AI: bmcpfs://cpfs-290******foflh-vpc-x****8r.cn-wulanchabu.cpfs.aliyuncs.com/data/path/

oss://bucket-name.oss-cn-shanghai-internal.aliyuncs.com/data/path/

DockerConfig

object

No

The Docker configuration of the instance.

ContainersLimit

integer

No

The maximum number of subcontainers in the instance.

10

Enable

boolean

No

Specifies whether to start Docker in the instance.

MountAccessConfigPath

string

No

The path where the mount permission configuration for secondary containers is located.

/etc/dsw/mount-access.json

Driver

string

No

The NVIDIA driver configuration.

535.54.03

DynamicMount DynamicMount

No

The dynamic mounting configuration.

EcsSpec

string

No

The ECS instance type of the instance. For information about how to obtain ECS instance types, see ListEcsSpecs.

ecs.c6.large

EnvironmentVariables

object

No

The environment variables injected into the DSW instance.

Warning The environment variables passed here may override the system preset environment variables.

{"userName":"Chris"}

string

No

The user-specified environment variables. After the DSW instance starts, the specified environment variables are injected into the container.

MAAS

ImageAuth

string

No

The value after Base64 encoding of the account and password information for the user's private image. The password part is hidden.

ZXhhbXBsZS11c2VyOkV4YW1wbGVQYXNzd29yZDEyMw==

ImageId

string

No

The image ID. For information about how to obtain the image ID, see ListImages.

image-05cefd0be2exxxx

ImageUrl

string

No

The image URL. For information about how to obtain the image URL, see ListImages.

registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu

InstanceName

string

No

The instance name. Format requirements:

  • The name can contain only letters, digits, and underscores (_).

  • The name cannot exceed 27 characters in length.

training_data

Labels deprecated

array<object>

No

The custom labels.

{'foo': 'bar'}

object

No

The custom label.

Key

string

No

The key of the custom label.

stsTokenOwner

Value

string

No

The value of the custom label.

123xxxxxxxx

MigrationOptions

object

No

The instance migration options. This parameter is supported only for Lingjun instances with persistent storage enabled. Supported options:

  • EnableProcessesPreservation: Specifies whether to preserve the running processes of the instance. Valid values: true and false. To enable this feature, the instance must reserve storage space for process migration.

{"EnableProcessesPreservation":true}

OversoldType

string

No

The type of oversold resources. Valid values:

  • ForceQuotaOverSold: Uses only oversold resources.

  • AcceptQuotaOverSold: Accepts oversold resources.

  • ForbiddenQuotaOverSold: Uses guaranteed resources.

ForceQuotaOverSold

Priority

integer

No

The priority of the instance. When resources are allocated to instances, instances with higher priorities are allocated first. Valid values: 1 to 9.

  • 1: The lowest priority.

  • 9: The highest priority.

1

RequestedResource

object

No

The resource configuration.

{"CPU":"4","Memory":"8Gi","SharedMemory":"4Gi","GPU":"1","GPUType":"Tesla-V100-16G"}

CPU

string

No

The number of CPU cores.

32

GPU

string

No

The number of GPUs.

4

GPUType

string

No

The GPU type. Valid values:

  • V100

  • A100

  • T4

  • A10

  • P100

v100

Memory

string

No

The memory size. Unit: GB.

Important Specify the unit when you pass this parameter, such as 32GB, instead of 32. If you do not specify the unit, the default unit is MB.

32GB

SharedMemory

string

No

The shared memory size. Unit: GB.

Important Specify the unit when you pass this parameter, such as 32GB, instead of 32. If you do not specify the unit, the default unit is MB.

32GB

ResourceId

string

No

The resource group ID. Configure this parameter for subscription resources. For information about how to create a dedicated resource group, see Prepare and manage DLC resource group clusters.

dsw-123456789

SpotSpec

object

No

The spot instance configuration.

SpotDiscountLimit

string

No

The maximum hourly discount for spot instances. This parameter is required for Lingjun instance types.

0.1

SpotDuration

string

No

The protection period of the spot instance. Default value: 1. You can set this parameter to 0 to specify no protection period. This parameter does not take effect for Lingjun instance types.

0

SpotPriceLimit

string

No

The maximum hourly price for the spot instance. The price is accurate to three decimal places. This parameter is required when the spot strategy is set to SpotWithPriceLimit.

0.12

SpotStrategy

string

No

The spot strategy. Valid values:

  • SpotWithPriceLimit: You manually set the maximum hourly price for the spot instance.

  • SpotAsPriceGo: The system automatically places bids based on the current market price.

SpotWithPriceLimit

Tag

array<object>

No

The list of tags.

object

No

The tag.

Key

string

No

The key of the tag.

tag1

Value

string

No

The value of the tag.

value1

UserCommand

object

No

The custom execution commands.

OnStart

object

No

The custom commands that are executed each time the instance starts. The commands are executed after the instance environment is initialized and before services such as jupyter-lab and code-server start.

Content

string

No

The content of the custom startup commands.

echo hello

UserId

string

No

The ID of the account that owns the instance. Alibaba Cloud accounts and Resource Access Management (RAM) users are supported.

161228528250****

UserMetricsEndpoints

array

No

The list of custom metrics collection endpoints.

UserMetricsEndpoint

No

The custom metrics collection endpoint, including the collection path and port.

UserVpc

object

No

The user VPC configuration.

BandwidthLimit BandwidthLimit

No

The Internet bandwidth throttling configuration.

DefaultRoute

string

No

The default routing. Valid values:

eth0

ExtendedCIDRs

array

No

The extended CIDR blocks.

  • If the vSwitch ID is empty, this parameter is optional. The system automatically obtains all CIDR blocks in the VPC.

  • If the vSwitch ID is not empty, this parameter is required. We recommend that you specify all CIDR blocks in the VPC.

["192.168.0.1/24", "192.168.1.1/24"]

string

No

The extended CIDR block.

"172.16.19.0/24","172.16.2.0/24","172.16.12.0/24"

ForwardInfos

array

No

The port forwarding information.

ForwardInfo

No

The port forwarding information list. You can configure parameters such as the mapped port, gateway ID, and SSH public key.

SecurityGroupId

string

No

The security group ID.

sg-xxxxxx

VSwitchId

string

No

The vSwitch ID.

vsw-xxxxx

VpcId

string

No

The VPC ID.

vpc-xxxxx

WorkspaceId

string

No

The workspace ID. For information about how to obtain the workspace ID, see ListWorkspaces.

40823

WorkspaceSource

string

No

The storage that corresponds to the working directory. You can mount cloud disks or datasets in Datasets to the /mnt/workspace working directory at the same time. OSS datasets and dynamically mounted datasets are not supported.

Valid values:

  • rootfsCloudDisk: Mounts the cloud disk to the working directory.

  • The mount path of the dataset: The MountPath of the dataset in Datasets, such as /mnt/data. Datasets in URI format can only be specified in this way.

  • The ID of the dataset, such as d-vsqjvs****rp5l206u. If the same dataset is mounted to multiple paths, the first path is selected. This method is not recommended. We recommend that you use the mount path.

If this parameter is left empty:

  • If the instance uses a cloud disk, the cloud disk is selected by default.

  • If no cloud disk is available, the first NAS or CPFS dataset is selected as the working directory.

  • If no cloud disk, NAS, or CPFS working directory is available, the host space is used.

rootfsCloudDisk

Response elements

Element

Type

Description

Example

object

The execution result.

Code

string

The status code. Valid values:

  • InternalError: An internal error. All errors other than parameter validation errors are currently classified as internal errors.

  • ValidationError: A parameter validation error.

null

HttpStatusCode

integer

The HTTP status code. Valid values:

  • 400

  • 404

  • 200

200

InstanceId

string

The instance ID.

dsw-730xxxxxxxxxx

Message

string

The description of the returned result.

"XXX"

RequestId

string

The request ID.

E7D55162-4489-1619-AAF5-3F97D5FCA948

Success

boolean

The success flag. Valid values:

  • true

  • false

true

Examples

Success response

JSON format

{
  "Code": "null",
  "HttpStatusCode": 200,
  "InstanceId": "dsw-730xxxxxxxxxx",
  "Message": "\"XXX\"",
  "RequestId": "E7D55162-4489-1619-AAF5-3F97D5FCA948",
  "Success": true
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.