UpdateInstance

更新时间:
复制 MD 格式

Updates the properties of 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

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

paidsw:UpdatePostPaidInstance

update

*All Resource

*

None None

Request syntax

PUT /api/v2/instances/{InstanceId} HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

The instance ID. For more information, see ListInstances.

dsw-730xxxxxxxxxx

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The instance properties to update.

InstanceName

string

No

The instance name. The name must meet the following requirements:

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

  • It must be no more than 27 characters in length.

training_data

EcsSpec

string

No

The ECS instance type. For more information, see ListEcsSpecs.

ecs.c6.large

ImageId

string

No

The image ID. For more information, see ListImages.

image-05cefd0be2exxxx

ImageUrl

string

No

The image URL. For more information, see ListImages.

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

UserVpc

object

No

The user VPC configuration.

VpcId

string

No

The VPC ID.

vpc-xxxxx

VSwitchId

string

No

The vSwitch ID.

vsw-xxxxx

SecurityGroupId

string

No

The security group ID.

sg-xxxxxx

ExtendedCIDRs

array

No

The extended CIDR blocks.

  • If you do not specify a vSwitch ID, you can leave this parameter empty. The system automatically obtains all CIDR blocks of the VPC.

  • If you specify a vSwitch ID, you must specify this parameter. We recommend that you specify all CIDR blocks of 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"

DefaultRoute

string

No

The default route. Valid values:

  • eth0: Use the default network interface controller (NIC). The instance accesses the external network through a public gateway.

  • eth1: Use the user's elastic network interface (ENI). The instance accesses the external network through a private gateway.

eth0

ForwardInfos

array

No

The instance port mapping configuration.

ForwardInfo

No

A ForwardInfo object.

BandwidthLimit

BandwidthLimit

No

Accessibility

string

No

The visibility of the instance.

Valid values:

  • PUBLIC :

    Visible to all users in the workspace.

  • PRIVATE :

    Visible only to the instance owner and administrators in the workspace.

PRIVATE

Datasets

array<object>

No

The list of datasets.

object

No

A dataset object.

DatasetId

string

No

The dataset ID. If the dataset is read-only, you cannot change the access mode to read-write using MountAccess.

For more information, see ListDatasets. You cannot specify this parameter if you specify Uri.

d-vsqjvs****rp5l206u

DatasetVersion

string

No

The dataset version. You must specify this parameter together with DatasetId. If you do not specify this parameter, the default value v1 is used.

v1

Uri

string

No

The URI of a directory in Service Catalog for direct mounting. This parameter is mutually exclusive with DatasetId.

The URI formats for different storage types are as follows:

  • 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/

  • Intelligent Computing CPFS: 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/

MountPath

string

No

The mount path of the dataset.

/mnt/data

MountAccess

string

No

The read and write permissions for the mounted dataset. If the dataset is read-only, you cannot set the permissions to read-write.

Valid values:

  • RW :

    Read-write

  • RO :

    Read-only

RW

Options

string

No

The custom properties for mounting the dataset. This parameter is supported only for OSS. You cannot specify OptionType when you use this parameter. 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" }

OptionType deprecated

string

No

The mount type. You cannot specify Options when you use this parameter. This parameter is deprecated. Use the Options parameter instead.

ReadOnly

Dynamic

boolean

No

Specifies whether to enable dynamic mounting. The default value is false.

  • This feature is supported only for instances that use general computing resources.

  • This feature is supported only for OSS datasets. The mounted dataset is in read-only mode.

  • The MountPath of a dynamically mounted dataset must be a subdirectory of the dynamic mount root path. The default root path is /mnt/dynamic/. An example is /mnt/dynamic/data1/.

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

false

DisassociateDatasets

boolean

No

Specifies whether to delete the associated datasets.

  • true: Delete the associated datasets.

  • false: Retain the associated datasets.

false

DisassociateVpc

boolean

No

Specifies whether to delete the associated user VPC.

false

DisassociateForwardInfos

boolean

No

Specifies whether to delete the associated port forwarding information.

false

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

Memory

string

No

The memory size in GB.

32

SharedMemory

string

No

The shared memory size in GB.

32

GPU

string

No

The number of GPUs.

4

GPUType

string

No

The GPU card type.

v100

WorkspaceSource

string

No

The storage for the working directory. You can mount a disk or a dataset from Datasets to the /mnt/workspace working directory. OSS datasets and dynamically mounted datasets are not supported.

You can specify one of the following values:

  • rootfsCloudDisk: Mounts the disk to the working directory.

  • The mount path of a dataset in Datasets, such as /mnt/data. For datasets specified by URI, you can only use this method.

  • The ID of a dataset, such as d-vsqjvs****rp5l206u. If the same dataset is mounted to multiple paths, the first path is selected. We recommend that you specify the mount path instead of the dataset ID.

If you leave this parameter empty:

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

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

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

/mnt/data

UserId

string

No

The ID of the user who uses the instance.

16122**********

CloudDisks

array<object>

No

The list of disks.

[]

object

No

Capacity

string

No

If you set Resource Type to Public Resources, or if you set Resource Quota to subscription general computing resources (CPU cores ≥ 2 and memory ≥ 4 GB, or with a GPU configured):

Each instance includes a 100 GiB free system disk for persistent storage. If the instance is stopped for more than 15 days, the content on the disk is deleted. You can scale out the disk. The scale-out price is subject to the price displayed on the console.

Warning
  • You cannot scale in a disk after it is scaled out. Scale out the disk as needed.

  • After a disk is scaled out, the entire system disk (free + paid) is no longer subject to the 15-day stop limit. However, fees are continuously generated.

  • When an instance is deleted, the system disk is released at the same time. Back up the necessary data before you delete the instance.

If you need durable storage, configure dataset mounting or add an OSS, NAS, or CPFS path in Storage Path Mounting.

100Gi

SubType

string

No

The disk type:

  • rootfs: The disk is mounted as a system disk. The system environment is stored on the disk.

rootfs

Priority

integer

No

The priority. When resources are allocated to instances, instances with higher priorities are given precedence. Valid values: 1 to 9.

  • 1 is the lowest priority.

  • 9 is the highest priority.

1

Driver

string

No

The NVIDIA driver configuration.

535.54.03

DisassociateDriver

boolean

No

Specifies whether to delete the NVIDIA driver configuration.

false

CredentialConfig CredentialConfig

No

The credential configuration.

DisassociateCredential

boolean

No

Specifies whether to delete the injected credential information.

false

Affinity

object

No

The affinity configuration.

CPU

object

No

The CPU affinity configuration. This is supported only for subscription general computing instances.

Enable

boolean

No

Specifies whether to enable CPU affinity.

  • true: Enable.

  • false: Disable.

true

ImageAuth

string

No

The Base64-encoded username and password for the user's private image. The password part is hidden.

****

DynamicMount DynamicMount

No

The dynamic mount configuration.

EnvironmentVariables

object

No

The environment variables to inject into the DSW instance.

Warning The environment variables that you specify may overwrite the preset system environment variables.

{ "ENABLE_TRAIN": "true", "ENABLE_DEBUG":"false", "INSTANCE_ENV":"prod" }

DisassociateEnvironmentVariables

boolean

No

Deletes the user-specified environment variables.

false

UserCommand

object

No

The user-defined execution command.

OnStart

object

No

A custom command that runs every time the instance starts. It runs after the instance environment is initialized but before services such as JupyterLab and code-server start.

Content

string

No

The content of the custom startup command.

apt update && echo initialized

DisassociateUserCommand

boolean

No

Deletes the user-specified custom command.

false

OversoldType

string

No

The type of idle resources.

ForceQuotaOverSold:只使用闲时资源 AcceptQuotaOverSold:可接受闲时资源 ForbiddenQuotaOverSold:使用保障资源

DisassociateSpot

boolean

No

SpotSpec

object

No

SpotStrategy

string

No

SpotWithPriceLimit

SpotPriceLimit

string

No

0.12

SpotDuration

string

No

0

SpotDiscountLimit

string

No

0.1

DisassociateAssignNode

boolean

No

AssignNodeSpec

object

No

NodeNames

string

No

node-a

AntiAffinityNodeNames

string

No

node-b

StartInstance

boolean

No

DisassociateMigrationOptions

boolean

No

MigrationOptions

object

No

Response elements

Element

Type

Description

Example

object

The execution result.

RequestId

string

The request ID.

E7D55162-4489-1619-AAF5-3F97D5FCA948

Success

boolean

Indicates whether the request was successful. Valid values:

  • true

  • false

true

Message

string

A message that describes the result.

"XXX"

Code

string

The status code. Valid values:

  • InternalError: An internal error occurred. All errors, except for parameter validation errors, are classified as internal errors.

  • ValidationError: A parameter validation error occurred.

null

HttpStatusCode

integer

The HTTP status code. Valid values:

  • 400

  • 404

null

InstanceId

string

The instance ID.

dsw-730xxxxxxxxxx

Examples

Success response

JSON format

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

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.