UpdateInstance

Updated at:

Updates the attributes 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 information about how to obtain the instance ID, see ListInstances.

dsw-730xxxxxxxxxx

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The instance attributes to update.

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.

CPU

object

No

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

Enable

boolean

No

Specifies whether to enable CPU affinity. Valid values:

  • true: Enabled.

  • false: Disabled.

true

AssignNodeSpec

object

No

The node scheduling configuration.

AntiAffinityNodeNames

string

No

The nodes to exclude from scheduling. Example: "node-a,node-b".

node-b

NodeNames

string

No

The nodes specified for scheduling. Example: "node-a,node-b".

node-a

CloudDisks

array<object>

No

The list of cloud disks.

[]

object

No

Capacity

string

No

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

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

Warning
  • You cannot reduce the capacity after expansion. Expand the capacity based on your business needs.

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

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

If you need permanent storage, you can configure dataset mounting or add OSS, NAS, or CPFS paths in storage path mounting.

100Gi

SubType

string

No

The cloud disk type. Valid values:

  • rootfs: The disk is mounted as a system cloud disk, and 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 object.

AccessPointId

string

No

The access point ID of BMCPFS (CPFS for AI). This parameter is used for fine-grained access control based on access points. This parameter 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. This parameter must be specified together with DatasetId. If you do not specify this parameter, the default value is v1.

v1

Dynamic

boolean

No

Specifies whether to enable dynamic mounting. Default value: false.

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

  • This feature supports only OSS datasets. 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, which is /mnt/dynamic/ by default. Example: /mnt/dynamic/data1/.

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

false

EnableCache

boolean

No

Specifies whether to enable local cache acceleration for the dataset. If you do not specify this parameter or set it to false, local cache acceleration is disabled. If you set it to true, local cache acceleration is enabled. This parameter takes effect only when the resources to which the instance belongs are 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/Write.

  • RO :

    Read-only.

RW

MountPath

string

No

The mount path of the dataset.

/mnt/data

OptionType deprecated

string

No

The mount type. You cannot specify this parameter and Options at the same time. This parameter is deprecated and we recommend that you use the Options parameter instead.

ReadOnly

Options

string

No

The custom dataset mount property. This parameter supports only OSS. You cannot specify this parameter and 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 mounting the dataset. This parameter is used for fine-grained access control for OSS datasets. This parameter is required when you specify AccessPointId to mount a BMCPFS (CPFS for AI) dataset.

acs:ram::1234567890123456:role/aliyunossmountrole

Uri

string

No

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

For more information about 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/

DisassociateAssignNode

boolean

No

Specifies whether to disable specified node scheduling.

DisassociateCredential

boolean

No

Specifies whether to delete the credential injection information.

false

DisassociateDatasets

boolean

No

Specifies whether to delete the associated datasets. Valid values:

  • true: deletes the associated datasets.

  • false: retains the associated datasets.

false

DisassociateDriver

boolean

No

Specifies whether to delete the NVIDIA driver configuration.

false

DisassociateEnvironmentVariables

boolean

No

Deletes the environment variables specified by the user.

false

DisassociateForwardInfos

boolean

No

Specifies whether to delete the associated port forwarding information.

false

DisassociateMigrationOptions

boolean

No

Specifies whether to delete the migration options.

DisassociateSpot

boolean

No

Specifies whether to disable the spot instance configuration.

DisassociateUserCommand

boolean

No

Deletes the custom commands specified by the user.

false

DisassociateVpc

boolean

No

Specifies whether to delete the associated user VPC.

false

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 the ECS instance type, 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.

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

ImageAuth

string

No

The Base64 encoding of the username and password for the user's private image. The password 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

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 retain the running processes of the instance. Valid values: true and false. To enable this feature, the instance must reserve the storage space required for process migration.

{"EnableProcessesPreservation":true}

OversoldType

string

No

The oversold resource type.

ForceQuotaOverSold: Uses only off-peak resources AcceptQuotaOverSold: Accepts off-peak resources ForbiddenQuotaOverSold: Uses guaranteed resources

Priority

integer

No

The priority. 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.

v100

Memory

string

No

The memory size. Unit: GB.

32

SharedMemory

string

No

The shared memory size. Unit: GB.

32

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: Sets a custom maximum price for the spot instance.

  • SpotAsPriceGo: Uses the system automatic bidding, which follows the actual market price.

SpotWithPriceLimit

StartInstance

boolean

No

Specifies whether to start the instance when the instance is updated. You can only start instances that are in the failed or stopped state.

UserCommand

object

No

The custom execution commands specified by the user.

OnStart

object

No

The custom command that is executed each time the instance starts. The command is 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 command.

apt update && echo initialized

UserId

string

No

The ID of the instance user.

16122**********

UserMetricsEndpoints

array

No

The list of custom metric collection endpoints specified by the user. Set this parameter to an empty array to clear the endpoints.

UserMetricsEndpoint

No

UserVpc

object

No

The user VPC configuration.

BandwidthLimit BandwidthLimit

No

DefaultRoute

string

No

The default routing. Valid values:

  • eth0: Uses the default network interface controller (NIC) to access external networks through the public gateway.

  • eth1: Uses the user elastic network interfaces (ENIs) to access external networks through the private gateway.

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 mapping configuration of the instance.

ForwardInfo

No

The forward information.

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

WorkspaceSource

string

No

The storage specified for 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.

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

  • Dataset ID: 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.

/mnt/data

Response elements

Element

Type

Description

Example

object

The execution result.

Code

string

The status code. Valid values:

  • InternalError: An internal error occurred. All errors other than 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

400

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": 400,
  "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.