You can call this operation to modify properties of a Block Storage device including its name, description, and whether to release it with the instance.

Description

If you set DeleteWithInstance to false and the instance to which the disk is attached is locked for security reasons (the OperationLocks parameter is set to "LockReason": "security"), the DeleteWithInstance parameter will be ignored and the disk will be released with the instance.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String No ModifyDiskAttribute

The operation that you want to perform. Set the value to ModifyDiskAttribute.

DiskId String No d-diskid1

The ID of the disk to be modified.

DiskName String No Test

The name of the disk. The name must be 2 to 128 characters in length. It must start with a letter but cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

Description String No Test

The description of the disk. The description must be 2 to 256 characters in length and cannot start with http:// or https://.

DeleteWithInstance Boolean No false

Specifies whether the disk is released with the instance. This parameter is empty by default.

An error will be returned if you set this parameter to false in the following cases:

  • When Category is set to ephemeral.
  • When Category is set to cloud and Portable is set to false.
DeleteAutoSnapshot Boolean No false

Specifies whether automatic snapshots are deleted when the disk is released. This parameter is empty by default.

EnableAutoSnapshot Boolean No true

Specifies whether to apply a created automatic snapshot policy to the disk. This parameter is empty by default.

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=ModifyDiskAttribute
&DiskId=d-23jbf2***
&DiskName=MyDiskName
&<Common request parameters>

Sample success responses

XML format

<ModifyDiskAttributeResponse>
      <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</ModifyDiskAttributeResponse>

JSON format

{
    "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

HTTP status code Error code Error message Description
404 InvalidDiskId.NotFound The specified disk does not exist. The error message returned because the specified DiskId parameter does not exist. Check whether the disk ID is correct.
400 InvalidDiskName.Malformed The specified disk name is wrongly formed. The error message returned because the specified DiskName parameter is invalid. The name must be 2 to 128 characters in length and can contain letters, digits, periods (.), underscores (_), and hyphens (-). It cannot start with http:// or https://.
404 InvalidDescription.Malformed The specified description is wrongly formed. The error message returned because the specified Description parameter is invalid. The description must be 2 to 256 characters in length and cannot start with http:// or https://.
400 NoAttributeToModify No attribute to be modified in this request. The error message returned because no properties of the specified snapshot are modified.
403 QuotaExceed.Snapshot The snapshot quota exceeds. The error message returned because the maximum number of snapshots has been reached. To create new snapshots, delete unnecessary snapshots without affecting your business.
403 DiskNotPortable The specified disk is not a portable disk. The error message returned because the specified disk is not removable.
403 IncorrectDiskStatus The operation is not supported in this status. The error message returned because the operation is not supported while the disk is in the current state. Ensure that the disk is available and has no overdue payments.
400 IncompleteParamter Some fields can not be null in this request. The error message returned because the required parameters are not specified.
403 UserNotInTheWhiteList The user is not in disk white list. The error message returned because you are not in the whitelist to manage the disk. Try again when you are in the whitelist.
400 InvalidRegionId.MalFormed The specified RegionId is not valid The error message returned because the specified RegionId parameter is invalid.
404 InvalidInstanceId.NotFound Specified instance does not exist. The error message returned because the specified InstanceId parameter does not exist. Check whether the instance ID is correct.

For a list of error codes, visit the API Error Center.