All Products
Search
Document Center

Elastic Compute Service:ModifyDiskAttribute

最終更新日:Dec 18, 2024

Modifies the attributes of block storage devices, including the names and descriptions of the devices and whether to release the devices together with the associated instances.

Operation description

Usage notes

  • When you call this operation to modify the attributes of a disk, if you set DeleteWithInstance to false and the instance to which the disk is attached is locked for security reasons, the DeleteWithInstance settings of the disk are ignored and the disk is released together with the instance. If "LockReason" : "security" is displayed in the response when you query the information about an instance, the instance is locked for security reasons.
  • You can use DiskIds.N to specify multiple block storage devices and batch modify the attributes of the devices, including the names and descriptions of the devices and whether to release the devices together with the associated instances.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:ModifyDiskAttributeupdate
*Disk
acs:ecs:{#regionId}:{#accountId}:disk/{#diskId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DiskIdstringNo

The ID of the disk.

Note You can specify the DiskId parameter or the DiskIds.N parameter, but you cannot specify both parameters at the same time.
d-bp1famypsnar20bv****
DiskNamestringNo

The name of the disk. The name must be 2 to 128 characters in length and can contain Unicode characters under the Decimal Number category and the categories whose names contain Letter. The name can also contain colons (:), underscores (_), periods (.), and hyphens (-).

MyDiskName
DescriptionstringNo

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

TestDescription
DeleteWithInstancebooleanNo

Specifies whether to release the disk along with its associated instance. This parameter is empty by default, which indicates that the current value remains unchanged.

An error is returned if you set DeleteWithInstance to false in one of the following cases:

  • The disk is a local disk.
  • The disk is a basic disk and is not removable. If the Portable attribute of a disk is set to false, the disk is not removable.
false
DeleteAutoSnapshotbooleanNo

Specifies whether to delete the automatic snapshots of the disk when the disk is released. This parameter is empty by default, which indicates that the current value remains unchanged.

false
EnableAutoSnapshotbooleanNo

Specifies whether to enable the automatic snapshot policy feature for the cloud disk. Valid values:

  • true
  • false

This parameter is empty by default, which indicates that the current value remains unchanged.

Note By default, the automatic snapshot policy feature is enabled for cloud disks. You only need to associate an automatic snapshot policy with a cloud disk before you can use the policy.
true
RegionIdstringYes

The region ID of the command. You can call the DescribeRegions operation to query the most recent list of regions.

cn-hangzhou
DiskIdsarrayNo

The ID of disk N. Valid values of N: 0 to 100.

Note You can specify the DiskId parameter or the DiskIds.N parameter, but you cannot specify both parameters at the same time.
stringNo

The ID of disk N. Valid values of N: 0 to 100.

Note You can specify the DiskId parameter or the DiskIds.N parameter, but you cannot specify both parameters at the same time.
d-bp1famypsnar20bv****
BurstingEnabledbooleanNo

Specifies whether to enable the performance burst feature for data disk N. Valid values:

  • true: encrypts the disk.
  • false: does not encrypt the disk.
false

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400InvalidDiskName.MalformedThe specified disk name is wrongly formed.The disk name is invalid. The name must be 2 to 128 characters in length and start with a letter. It can contain letters, digits, periods (.), underscores (_), and hyphens (-) and cannot start with http:// or https.
400NoAttributeToModifyNo attribute to be modified in this request.No attributes are modified.
400IncompleteParamterSome fields can not be null in this request.Some required parameters are not specified.
400InvalidRegionId.MalFormedThe specified RegionId is not valid.The specified region does not exist.
400MissingParameter.DiskIdOrDiskIdsSpecified parameter DiskId or DiskIds is missing.-
400ParameterConflict.DiskIdAndDiskIdsSpecified parameter DiskId and DiskIds conflict, only one can be chosen.-
400BurstingEnabledForDiskCategoryUnsupportedThe specified disk category does not support bursting enabled.-
400BurstingEnabledForMultiAttachDiskUnsupportedThe multi attach disk does not support bursting enabled.-
400BurstingEnabledForModifyingDiskUnsupportedThe modifying disk does not support bursting enabled.-
403QuotaExceed.SnapshotThe snapshot quota exceeds.The maximum number of snapshots has been reached. Delete snapshots that are no longer needed and try again.
403DiskNotPortableThe specified disk is not a portable disk.The specified disk is not removable.
403IncorrectDiskStatusThe operation is not supported in this status.The disk is in a state that does not support the current operation. Make sure that the disk is available and that your account has no overdue payments.
403UserNotInTheWhiteListThe user is not in disk white list.You are not authorized to manage the disk. Try again when you are authorized.
403DeleteWithInstance.ConflictThe specified image is from the image market, you cannot set DeleteWithInstance attribute to false.-
403DeleteWithInstance.ConflictMulti attach disk cannot be set to DeleteWithInstance attribute.Disks for which the multi-attach feature is enabled do not support the DeleteWithInstance attribute.
404InvalidDiskId.NotFoundThe specified disk does not exist.The specified disk does not exist. Check whether the disk ID is correct.
404InvalidDescription.MalformedThe specified description is wrongly formed.The resource description is invalid. The description must be 2 to 256 characters in length and cannot start with http:// or https://.
404InvalidInstanceId.NotFoundSpecified attached instance does not exist.The specified instance does not exist. Check whether the instance ID is correct.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-12-04API Description Update. The Error code has changedView Change Details
2023-08-25The Error code has changedView Change Details