Help Center/ Elastic Cloud Server/ API Reference/ APIs/ Disk Management/ Modifying a Single Disk Attached to an ECS
Updated on 2026-03-19 GMT+08:00

Modifying a Single Disk Attached to an ECS

Function

This API is used to modify the information about a single disk attached to an ECS.

Currently, only the delete_on_termination parameter can be modified.

Constraints

  • Yearly/monthly-billed disks cannot be modified.
  • Shared disks cannot be modified.
  • System disks cannot be modified.

Debugging

You can debug this API in API Explorer.

Authorization

Each account has all of the permissions required to call all APIs, but IAM users must have the required permissions specifically assigned.
  • If you are using role/policy-based authorization, see the required permissions in Permissions and Supported Actions.
  • If you are using identity policy-based authorization, the permissions listed below are required.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

ecs:cloudServers:updateServerBlockDevice

write

instance *

-

ecs:cloudServers:put

-

URI

PUT /v1/{project_id}/cloudservers/{server_id}/block_device/{volume_id}

Table 1 lists the parameters.

Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Definition

Specifies the project ID.

For details about how to obtain the ID, see Obtaining a Project ID.

Constraints

N/A

Range

N/A

Default Value

N/A

server_id

Yes

Definition

Specifies the ECS ID.

Constraints

N/A

Range

N/A

Default Value

N/A

volume_id

Yes

Definition

Specifies the disk ID.

Constraints

N/A

Range

N/A

Default Value

N/A

Request

Table 2 Request parameter

Parameter

Mandatory

Type

Description

block_device

Yes

Object

Definition

Updates the information about a disk attached to the ECS. For details, see Table 3.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 3 block_device parameter

Parameter

Mandatory

Type

Description

delete_on_termination

Yes

Boolean

Definition

Specifies whether the disk attached to the ECS is deleted when the ECS is deleted.

Constraints

  • Yearly/monthly-billed disks cannot be modified.
  • Shared disks cannot be modified.
  • System disks cannot be modified.

Range

  • true: The disk is deleted when the ECS is deleted.
  • false: The disk is not deleted when the ECS is deleted.

Default Value

N/A

Response

None

Example Request

Set a disk to be deleted together with the ECS when the attached ECS is deleted.

PUT https://{endpoint}/v1/{project_id}/cloudservers/{server_id}/block_device/{volume_id}
{
	"block_device": {
		"delete_on_termination": true
	}
}

Example Response

None

Error Codes

See Error Codes.