Creates a Pay-As-You-Go or Subscription data disk. You can create a basic disk, an Ultra disk, or an SSD disk.

Description

  • To ensure that instances can be successfully created, you must maintain a sufficient balance in your linked credit card or PayPal account. For more information, see Charging overview.
  • By default, the DeleteAutoSnapshot parameter is set to true when a disk is created. This indicates that when the disk is released, snapshots that were created from the disk are deleted together with the disk. You can call ModifyDiskAttribute to modify the parameter value.
  • The default performance level of an ESSD cloud disk is PL1 if you do not specify the performance level when you create the ESSD cloud disk. You can call ModifyDiskSpec to modify the performance level of an ESSD cloud disk.
  • By default, the Portable attribute of disks created by calling this operation is set to true, and the billing method is Pay-As-You-Go.
  • You must specify either the Size or SnapshotId parameter. The Size parameter specifies the size of the disk and the SnapshotId parameter specifies the snapshot that is used to create the disk.

Debugging

You can use API Explorer to perform debugging. API Explorer allows you to perform various operations to simplify API usage. For example, you can retrieve APIs, call APIs, and dynamically generate SDK example code.

Request parameters

Name Type Required Example Description
RegionId String Yes cn-hangzhou

The ID of the region to which the instance belongs. You can call DescribeRegions to view the latest regions of Alibaba Cloud.

Action String No CreateDisk

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

ZoneId String No cn-hangzhou-g

Creates a Pay-As-You-Go disk in a specified availability zone. You cannot specify ZoneId and InstanceId simultaneously.

InstanceId String No i-bp1g6zv0ce8og******p Creates a Subscription disk and the system automatically attaches it to a Subscription instance with the InstanceId you specified.
  • If you enter the InstanceId in this request, the ResourceGroupId, Tag,N,Key, Tag.N.Value, ClientToken, and KMSKeyId are not effective any longer.
  • You cannot specify ZoneId and InstanceId simultaneously.

Default value: null, which indicates you create a Pay-As-You-Go disk. While you must specify the ZoneId if you choose the default setting for InstanceId.

ClientToken String No 123e4567-e89b-12d3-a456-426655440000

A client token. It is used to ensure the idempotency of requests. The value of this parameter is generated by the client and is unique among different requests. The ClientToken parameter must be no more than 64 ASCII characters in length. For more information, see How to ensure idempotence.

Description String No FinanceDisk

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

DiskCategory String No cloud_ssd

The category of the data disk. Valid values:

  • cloud: basic disk
  • cloud_efficiency: ultra disk
  • cloud_ssd: SSD
  • cloud_essd: ESSD

Default value: cloud.

DiskName String No FinanceJoshua

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

Encrypted Boolean No false

Indicates whether the disk is encrypted. Default value: false.

KMSKeyId String No 0e478b7a-4262-4802-b8cb-00d3fb40826X

The ID of the KMS key corresponding to the data disk.

ResourceGroupId String No rg-resourcegroupid1

The ID of the resource group to which the disk belongs.

Size Integer No 2000

The size of the disk. Unit: GiB. The value of this parameter must be equal to or greater than the size of the specified snapshot. Valid values:

  • cloud: 5 to 2000
  • cloud_efficiency: 20 to 32768
  • cloud_ssd: 20 to 32768
  • cloud_essd: 20 to 32768
SnapshotId String No s-snapshot1

The ID of the snapshot used to create the disk. If this parameter is specified, the Size parameter will be ignored, and the size of the created disk will be the size of the specified snapshot. The specified snapshot cannot be created on or before July 15, 2013.

Tag.N.Key String No FinanceDept

The tag key of the disk. Valid values of N: 1 to 20. It cannot be a null string. It can be a maximum of 64 characters in length. It cannot start with aliyun or acs:. It cannot contain http:// or https://.

Tag.N.Value String No FinanceDeptJoshua

The tag value of the disk. Valid values of N: 1 to 20. It can be a null string. It can be a maximum of 128 characters in length. It cannot start with aliyun or acs:. It cannot contain http:// or https://.

PerformanceLevel String No PL1

The performance level you select for an ESSD cloud disk. Valid values:

  • PL1 (default value): The maximum random read/write IOPS of a single disk is 50,000.
  • PL2: The maximum random read/write IOPS of a single disk is 100,000.
  • PL3: The maximum random read/write IOPS of a single disk is 1,000,000.

For information about how to select a performance level for an ESSD cloud disk, see ESSD cloud disk.

Response parameters

Name Type Example Description
DiskId String d-bp131n0q38u3a4ziXXXXX

The ID of the disk.

RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=CreateDisk
&RegionId=cn-hangzhou 
&ZoneId=cn-hangzhou-g
&SnapshotId=s-snapshot1
&DiskName=FinanceJoshua
&Size=2000
&DiskCategory=cloud_ssd 
&Description=FinanceDisk
&Encrypted=false
&ClientToken=123e4567-e89b-12d3-a456-426655440000
&Tag. 1.value=FinanceDeptJoshua
&Tag. 1.key=FinanceDept
&Tag. 1. Key=FinanceDept
&Tag. 1. Value=FinanceDeptJoshua
&<Common request parameters>

Successful response examples

XML format

<CreateDiskResponse>
  <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId> 
  <DiskId>d-bp131n0q38u3a4ziXXXXX</DiskId>
</CreateDiskResponse>

JSON format

{
	"RequestId":"473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
	"DiskId":"d-bp131n0q38u3a4ziXXXXX"
}

Errors

HTTP status code Error code Error message Meaning
403 InvalidDataDiskCategory.NotSupported Specified disk category is not supported. The error message returned when the specified disk category does not support this operation.
404 InvalidRegionId.NotFound The specified RegionId does not exist. The error message returned when the specified Region ID does not exist. Check whether the service is available in this region.
404 InvalidZoneId.NotFound The specified zone does not exist. The error message returned when the specified zone does not exist.
403 InvalidSnapshot.TooOld This operation is forbidden because the specified snapshot is created before 2013-07-15. The error message returned when the specified source snapshot was created on or before July 15, 2013 and cannot be reinitialized.
403 InvalidSnapshot.TooLarge The capacity of snapshot exceeds 2000GB. The error message returned when the size of the specified snapshot exceeds 2,000 GB.
403 OperationDenied The specified snapshot is not allowed to create disk. The error message returned when the specified snapshot cannot be used to create a disk.
400 MissingParameter The input parameter either SnapshotId or Size should be specified. The error message returned when neither the SnapshotId parameter nor the Size parameter is specified.
403 InvalidDiskCategory.ValueUnauthorized The disk category is not authorized. The error message returned when you are not authorized to use the specified disk category.
403 InvalidSnapshotId.NotReady The specified snapshot has not completed yet. The error message returned when the specified snapshot is being created.
403 InvalidDiskSize.TooSmall Specified disk size is less than the size of snapshot. The error message returned when the specified disk size is smaller than that of the snapshot.
403 OperationDenied The type of the disk does not support the operation. The error message returned when the specified data disk type does not support this operation.
403 InvalidDataDiskCategory.NotSupported %s The error message returned when the specified data disk type does not support this operation.
400 Account.Arrearage Your account has an outstanding payment. The error message returned when your account has overdue payments.
400 InvalidDiskCategory.ValueNotSupported The specified parameter DiskCategory is not valid. The error message returned when the specified value of the DiskCategory parameter is invalid.
403 InvalidAccountStatus.NotEnoughBalance Your account does not have enough balance. The error message returned when your account balance is insufficient. You must top up your account before proceeding.
400 InvalidDataDiskCategory.ValueNotSupported %s The error message returned when the parameter is not supported.
400 InvalidParameter.Conflict %s The error message returned when the parameter conflicts with another parameter.
400 InvalidDataDiskSize.ValueNotSupported %s The error message returned when the parameter is not supported.
400 OperationDenied The specified Zone is not available or not authorized. The error message returned when the specified zone is unavailable or you are not authorized to access it.
403 InvalidDiskCategory.NotSupported The specified disk category is not supported. The error message returned when the specified disk category is not supported.
403 InvalidDiskSize.NotSupported The specified disk size is not supported. The error message returned when the specified disk size is not supported.
400 InvalidDiskSize.NotSupported The specified parameter size is not valid. The error message returned when the specified Size parameter is invalid.
403 UserNotInTheWhiteList The user is not in disk white list. The error message returned when you are not authorized to use the specified disk.
400 InvalidParameter.EncryptedIllegal %s The error message returned when the parameter is not supported because the disk is encrypted.
400 InvalidParameter.EncryptedNotSupported %s The error message returned when the parameter is not supported because the disk is encrypted.
400 EncryptedOption.Conflict %s The error message returned when the parameter is not supported because the disk is encrypted.
400 InvalidParameter.Encrypted.KmsNotEnabled The encrypted disk need enable KMS The error message returned when KMS has not been activated. KMS must be activated to encrypt disks.
500 InternalError The request processing has failed due to some unknown error, exception or failure. The error message returned when an unknown error occurs.
403 InvalidRegion.NotSupport The specified region does not support byok. The error message returned when BYOK is not supported in this region.
403 UserNotInTheWhiteList The user is not in byok white list. The error message returned when you are not authorized to use BYOK.
400 InvalidParameter.EncryptedIllegal The specified parameter Encrypted must be true when kmsKeyId is not empty. The error message returned when you have not enabled the encryption attribute after specifying the KMSKeyId parameter.
404 InvalidParameter.KMSKeyId.NotFound The specified KMSKeyId does not exist. The error message returned when the specified KMSKeyId parameter does not exist.
403 InvalidParameter.KMSKeyId.KMSUnauthorized ECS service have no right to access your KMS. The error message returned when ECS is not authorized to access your KMS resources.

View error codes