Queries the most recent prices of Elastic Compute Resource (ECS) resources.
Usage notes
- The required parameters vary based on the types of resources whose prices you want to query.
- If you set
ResourceType
to instance, specifyInstanceType
. - If you set
ResourceType
to disk, specifyDataDisk.1.Category
andDataDisk.1.Size
. If you setResourceType
to disk, only pay-as-you-go prices of cloud disks are returned. In this case, you can setPriceUnit
only toHour
. - If you set
ResourceType
to ddh, specifyDedicatedHostType
. - If you set
ResourceType
to ElasticityAssurance, specifyInstanceType
. - If you set
ResourceType
to CapacityReservation, specifyInstanceType
.
- If you set
- If you set
ResourceType
to bandwidth, only the pay-by-traffic (PayByTraffic
) price for network usage is returned. - If you set
ResourceType
to instance, you can query the prices of up to four data disks. - By default,
ChargeType
is set toPostPaid
. You can specifyPriceUnit
to query the prices of ECS resources that have different billing cycles.
Debugging
Request parameters
Parameter |
Type |
Required |
Example |
Description |
Action | String | Yes | DescribePrice | The operation that you want to perform. Set the value to DescribePrice. |
RegionId | String | Yes | cn-hangzhou | The region ID of the resource. You can call the DescribeRegions operation to query the most recent region list. |
ResourceType | String | No | instance | The type of the resource. Valid values:
Default value: instance. |
ImageId | String | No | centos_7_05_64_20G_alibase_20181212.vhd | The ID of the image. This parameter is valid only if you set ResourceType to instance. Images contain runtime environments to load when instances start. You can call the DescribeImages operation to query the available images. If you do not specify this parameter, the system queries the prices of Linux images. |
InstanceType | String | No | ecs.g6.large | The instance type. If you set |
DedicatedHostType | String | No | ddh.c5 | The type of the dedicated host. You can call the DescribeDedicatedHostTypes operation to query the most recent list of dedicated host types. |
IoOptimized | String | No | optimized | Specifies whether the instance is I/O optimized. Valid values:
If the instance type specified by InstanceType belongs to Generation I instance families, the default value is none. If the instance type specified by InstanceType does not belong to Generation I instance families, the default value is optimized. |
InstanceNetworkType | String | No | vpc | The network type of the instance. Valid values:
Default value: vpc. |
InternetChargeType | String | No | PayByTraffic | The billing method for network usage. Valid values:
Default value: PayByTraffic. |
InternetMaxBandwidthOut | Integer | No | 5 | The maximum outbound public bandwidth. Unit: Mbit/s. Valid values: 0 to 100. Default value: 0. |
SystemDisk.Category | String | No | cloud_ssd | The category of the system disk. Valid values:
Description of the default values:
Note If you want to query the price of a system disk, specify ImageId . |
SystemDisk.Size | Integer | No | 80 | The size of the system disk. Unit: GiB. Valid values: 20 to 500. Default value: 20 or the image size, whichever is greater. |
SystemDisk.PerformanceLevel | String | No | PL1 | The performance level of the system disk when it is an ESSD. This parameter is valid only if you set PL0 PL1 (default) PL2 PL3 |
DataDisk.1.Size | Integer | No | 2000 | To improve scalability, we recommend that you use |
DataDisk.1.Category | String | No | cloud_ssd | To improve scalability, we recommend that you use |
DataDisk.1.PerformanceLevel | String | No | PL1 | To improve scalability, we recommend that you use |
DataDisk.2.Size | Integer | No | 200 | To improve scalability, we recommend that you use |
DataDisk.2.Category | String | No | cloud_ssd | To improve scalability, we recommend that you use |
DataDisk.2.PerformanceLevel | String | No | PL1 | To improve scalability, we recommend that you use |
DataDisk.3.Size | Integer | No | 2000 | To improve scalability, we recommend that you use |
DataDisk.3.Category | String | No | cloud_ssd | To improve scalability, we recommend that you use |
DataDisk.3.PerformanceLevel | String | No | PL1 | To improve scalability, we recommend that you use |
DataDisk.4.Size | Integer | No | 2000 | To improve scalability, we recommend that you use |
DataDisk.4.Category | String | No | cloud_ssd | To improve scalability, we recommend that you use |
DataDisk.4.PerformanceLevel | String | No | PL1 | To improve scalability, we recommend that you use |
Period | Integer | No | 1 | The billing cycle of the instance. Valid values:
Default value: 1. |
PriceUnit | String | No | Year | The pricing unit of the resource. Valid values:
|
Amount | Integer | No | 1 | The number of instances that you want to purchase. You can specify this parameter if you want to query the prices of multiple instances that have specific specifications. Valid values: 1 to 1000 Default value: 1. |
OfferingType | String | No | All Upfront | The payment option of the reserved instance. Valid values:
|
InstanceAmount | Integer | No | 100 | The total number of instances for which the capacity of an instance type is reserved. Valid values: 1 to 1000. |
Scope | String | No | Zone | The scope of reserved instance N. Valid values:
Default value: Region. |
Platform | String | No | Linux | The type of the operating system. Valid values:
|
Capacity | Integer | No | 1024 | The storage capacity. Unit: GiB. |
AssuranceTimes | String | No | Unlimited | The total number of times that the elasticity assurance can be applied. Set the value to Unlimited. This value indicates that the elasticity assurance can be applied an unlimited number of times within its effective period. Default value: Unlimited. |
InstanceCpuCoreCount | Integer | No | 1024 | The total number of vCPUs supported by the elasticity assurance. When you call this API operation, the system calculates the number of instances that an elasticity assurance must support based on the specified InstanceType value and rounds up the calculated value. Note When you call this API operation to query the prices of elasticity assurances, you can specify InstanceCoreCpuCount or InstanceAmount. |
Isp | String | No | cmcc | The Internet service provider (ISP). Valid values:
|
InstanceTypeList.N | String | No | ecs.c6.xlarge | The instance type of instance N. You can select only a single instance type when you configure an elasticity assurance in unlimited mode. |
SpotStrategy | String | No | NoSpot | The preemption policy for the pay-as-you-go instance. Valid values:
Default value: NoSpot. Note This parameter is valid only if you set PriceUnit to Hour and Period to 1. The default value of PriceUnit is Hour , and the default value of Period is 1 . Therefore, you do not need to specify PriceUnit or Period if you specify SpotStrategy. |
SpotDuration | Integer | No | 1 | The protection period of the preemptible instance. Unit: hours. Default value: 1. Valid values:
Alibaba Cloud sends ECS system events to notify you 5 minutes before the instance is released. Preemptible instances are billed by second. We recommend that you specify a protection period based on your business requirements. Note If you set SpotStrategy to SpotWithPriceLimit or SpotAsPriceGo, this parameter takes effect. |
ZoneId | String | No | cn-hagzhou-i | The zone ID of the ECS resource. Note The prices of preemptible instances vary based on the zone. To query the prices of preemptible instances, we recommend that you specify ZoneId. |
DataDisk.N.Category | String | No | cloud_ssd | The category of data disk N. Valid values:
Valid values of N: 1 to 16 |
DataDisk.N.Size | Long | No | 2000 | The size of data disk N. Unit: GiB. Valid values:
Valid values of N: 1 to 16. |
DataDisk.N.PerformanceLevel | String | No | PL1 | The performance level of data disk N when it is an ESSD. This parameter is valid only if you set
Valid values of N: 1 to 16. |
SchedulerOptions.DedicatedHostId | String | No | dh-bp67acfmxazb4p**** | This parameter is valid only if you set ResourceType to instance. The ID of the dedicated host. You can call the DescribeDedicatedHosts operation to query the most recent dedicated host list. |
Response parameters
Parameter |
Type |
Example |
Description |
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E | The ID of the request. |
PriceInfo | Object | The information about the prices and discount rules. |
|
Rules | Array of Rule | The promotion rules. |
|
Rule | |||
Description | String | Receive a 15% discount on a 1-year subscription. | The description of the promotion rule. |
RuleId | Long | 587 | The ID of the promotion rule. |
Price | Object | The price. |
|
OriginalPrice | Float | 4368 | The original price. |
ReservedInstanceHourPrice | Float | 1 | The hourly price of the reserved instance for which the No Upfront or Partial Upfront payment option is used. |
DiscountPrice | Float | 655.2 | The discount. |
Currency | String | CNY | The currency unit. China site (aliyun.com): CNY International site (alibabacloud.com): USD. |
TradePrice | Float | 3712.8 | The transaction price, which is equal to the original price minus the discount. |
DetailInfos | Array of ResourcePriceModel | The price details. Note This parameter is in invitational preview and is not publicly available. |
|
ResourcePriceModel | |||
Resource | String | instance | The name of the resource. |
OriginalPrice | Float | 4368 | The original price. |
DiscountPrice | Float | 655.2 | The discount. |
TradePrice | Float | 3712.8 | The transaction price. |
SubRules | Array of Rule | The pricing rules. |
|
Rule | |||
Description | String | Receive a 15% discount on a 1-year subscription. | The description of the pricing rule. |
RuleId | Long | 587 | The ID of the promotion rule. |
Examples
Sample requests
http(s)://ecs.aliyuncs.com/?Action=DescribePrice
&RegionId=cn-hangzhou
&ResourceType=instance
&InstanceType=ecs.g6.large
&ImageId=centos_7_05_64_20G_alibase_20181212.vhd
&InstanceNetworkType=vpc
&InternetChargeType=PayByTraffic
&InternetMaxBandwidthOut=5
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribePriceResponse>
<RequestId>04F0F334-1335-436C-A1D7-6C044FE73368</RequestId>
<PriceInfo>
<Price>
<Currency>CNY</Currency>
<DiscountPrice>655.2</DiscountPrice>
<ReservedInstanceHourPrice>0</ReservedInstanceHourPrice>
<OriginalPrice>4368</OriginalPrice>
<TradePrice>3712.8</TradePrice>
</Price>
<Rules>
<Rule>
<Description>Receive a 15% discount on a 1-year subscription. </Description>
<RuleId>ONE_YEAR_85_PERCENT</RuleId>
</Rule>
</Rules>
</PriceInfo>
</DescribePriceResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "04F0F334-1335-436C-A1D7-6C044FE73368",
"PriceInfo" : {
"Price" : {
"Currency" : "CNY",
"DiscountPrice" : 655.2,
"ReservedInstanceHourPrice" : 0,
"OriginalPrice" : 4368,
"TradePrice" : 3712.8
},
"Rules" : {
"Rule" : [ {
"Description" : "Receive a 15% discount on a 1-year subscription.",
"RuleId" : "ONE_YEAR_85_PERCENT"
} ]
}
}
}
Error codes
HttpCode |
Error code |
Error message |
Description |
400 | InvalidSpotAuthorized | The specified Spot param is unauthorized. | You cannot specify SpotDuration. |
400 | InvalidInstanceType.ValueUnauthorized | The specified InstanceType is not authorized. | You cannot use the instance type. |
400 | InvalidInstanceType.ValueNotSupported | The specified InstanceType does not exist or beyond the permitted range. | The instance type does not exist, or you cannot manage instances of the instance type. |
400 | InvalidInternetChargeType.ValueNotSupported | The specified InternetChargeType is not valid. | Invalid instance billing method for network usage. |
400 | InvalidDataDiskSize.ValueNotSupported | The specified DataDisk.n.Size beyond the permitted range, or the capacity of snapshot exceeds the size limit of the specified disk category. | The DataDisk.N.Size value is invalid, or the snapshot size exceeds the maximum capacity that is allowed for the disk category. |
400 | InvalidParameter.Conflict | The specified image does not support the specified instance type. | The specified image cannot be used for instances of the specified instance type. |
400 | InvalidIoOptimizedValue.ValueNotSupported | IoOptimized value not supported. | Invalid IoOptimized value. |
400 | InvalidPeriod | The specified period is not valid. | Invalid Period value. |
400 | InstanceDiskCategoryLimitExceed | The specified DataDisk.n.Size beyond the permitted range, or the capacity of snapshot exceeds the size limit of the specified disk category. | The DataDisk.N.Size value is invalid, or the snapshot size exceeds the maximum capacity that is allowed for the disk category. |
400 | InvalidInternetMaxBandwidthOut.ValueNotSupported | The specified vm bandwidth is not valid. | Invalid instance bandwidth. |
400 | InvalidInternetMaxBandwidthOut.ValueNotSupported | The specified parameter Bandwidth is not valid. | Invalid Bandwidth value. |
400 | InstanceDiskNumber.LimitExceed | The total number of specified disk in an instance exceeds. | The maximum number of disks for an instance has been exceeded. |
400 | InvalidInternetMaxBandwidthOut.ValueNotSupported | %s | Invalid InternetMaxBandwidthOut value. |
400 | InvalidDataDiskCategory.ValueNotSupported | %s | Invalid data disk category. %s is a variable. An error message is dynamically returned based on the call conditions. |
400 | InvalidSystemDiskCategory.ValueNotSupported | %s | The operation is not applicable to the specified system disk category. |
400 | InvalidParameter.Conflict | %s | Invalid parameter value. Check whether parameter conflicts exist. %s is a variable. An error message is dynamically returned based on the call conditions. |
400 | InvalidInternetChargeType.ValueNotSupported | %s | Invalid InternetChargeType value. |
400 | InvalidInstanceType.ValueNotSupported | %s | The specified instance type does not support this operation. |
400 | RegionUnauthorized | %s | You cannot perform the operation in the region. %s is a variable. An error message is dynamically returned based on the call conditions. |
400 | InvalidSystemDiskSize.ValueNotSupported | %s | Invalid SystemDisk.Size value. |
400 | InvalidDataDiskSize.ValueNotSupported | %s | Invalid data disk size. %s is a variable. An error message is dynamically returned based on the call conditions. |
400 | Throttling | Request was denied due to request throttling. | The request is denied due to throttling. |
400 | PriceNotFound | The price of your queried resource is not available now, please try other resources. | The price of the resource does not exist. Change the parameter value and try again. |
400 | InvalidResourceType.ValueNotSupported | The specified parameter ResourceType is not valid. | Invalid ResourceType value. |
400 | InvalidPriceUnit.ValueNotSupported | The specified parameter PriceUnit is not valid. | Invalid PriceUnit value. |
400 | InvalidInternetMaxBandwidthOut.ValueNotSupported | The specified parameter InternetMaxBandwidthOut is not valid. | Invalid InternetMaxBandwidthOut value. |
400 | EncryptedOption.Conflict | %s | The parameter that is used to encrypt disks is not supported. %s is a variable. An error message is dynamically returned based on the call conditions. |
400 | IncorrectImageStatus | The specified image is an Alibaba Cloud Marketplace image. The sale of this image has ended. For more information, contact the image service provider. | The specified image is an Alibaba Cloud Marketplace image. The sale period for this image has ended. For more information, contact the image service provider. |
400 | InvalidAssuranceTimes.NotSupported | The value of AssuranceTimes is not supported. | Invalid AssuranceTimes value. |
400 | InvalidParameter.Platform | The specified parameter Platform is invalid. | Invalid Platform value. |
400 | InvalidOperation.InstanceRenewWithDowngradeInPlan | The operation is denied due to the specified instance has renew with downgrade record in plan. | You have renewal and configuration downgrade orders that do not take effect. This operation cannot be performed until the orders take effect. |
403 | ImageNotSubscribed | The specified image has not be subscribed. | You have not subscribed to the image in Alibaba Cloud Marketplace. |
403 | OperationDenied | The specified Image is disabled or is deleted. | The image is disabled or deleted. |
403 | InvalidSystemDiskCategory.ValueUnauthorized | The disk category is not authorized. | You cannot use the disk category. |
403 | InstanceDiskCategoryLimitExceed | The total size of specified disk category in an instance exceeds. | The maximum disk capacity of the category for an instance is exceeded. |
403 | ImageRemovedInMarket | The specified market image is not available, Or the specified user defined image includes product code because it is based on an image subscribed from marketplace, and that image in marketplace includeing exact the same product code has been removed. | The Alibaba Cloud Marketplace image is unavailable, or the custom image contains the product code of the Alibaba Cloud Marketplace image from which the custom image is derived and the Alibaba Cloud Marketplace image was removed from Alibaba Cloud Marketplace. |
403 | QuotaExceed.PortableCloudDisk | The quota of portable cloud disk exceeds. | The maximum number of removable disks is exceeded. |
403 | Forbbiden | User not authorized to operate on the specified resource. | You cannot perform operations on the resource. |
403 | InstanceDiskNumLimitExceed | The number of specified disk in an instance exceeds. | The maximum number of disks for an instance is exceeded. |
403 | IoOptimized.NotSupported | The specified image is not support IoOptimized Instance. | The specified image does not support I/O optimized instances. |
403 | ImageNotSupportInstanceType | The specified image don't support the InstanceType instance. | The specified image does not support the selected instance type. |
403 | InvalidDiskSize.TooSmall | Specified disk size is less than the size of snapshot. | The specified disk size is smaller than the snapshot size. |
403 | OperationDenied | The type of the disk does not support the operation. | The disk category does not support this operation. |
403 | InvalidDiskCategory.Mismatch | The specified disk categories combination is not supported. | The combination of specified disk categories is not supported. |
403 | InvalidDiskCategory.NotSupported | The specified disk category is not support the specified instance type. | The disk category does not support the instance type. |
403 | InvalidDiskCategory.NotSupported | The upgrade operation of instance does not support this category of disk. | The instance upgrade operations do not support the disk category. |
403 | InvalidParameter.ResourceOwnerAccount | ResourceOwnerAccount is Invalid. | Invalid ResourceOwnerAccount value. |
403 | RegionUnauthorized | There is no authority to create instance in the specified region. | You cannot create instances in the region. |
403 | OperationDenied | The resource is out of usage. | The instance is not in the Running state. Start the instance or check whether the operation is supported. |
403 | InstanceType.Offline | %s | The operation cannot be performed on the instance if the instance type is retired or if the stock of the instance type is insufficient. |
403 | OperationDenied | The specified parameter InstanceNetworkType is not authorized. | You cannot use the network type. |
403 | InvalidAmount.Malformed | The specified parameter Amount is not valid. | Invalid Amount value. |
403 | InvalidDiskIds.NotFound | Some of the specified disks do not exist. | The disk does not exist. |
403 | InvalidDiskCategory.NotSupported | The specified disk category is not supported. | The specified disk category does not support this operation. |
403 | PrePaidInstance.Expired | The prePaid instance has expired. | The subscription instance has expired. |
403 | InvalidAction.Unauthorized | The specified action is not valid. | The operation is invalid. |
403 | InvalidInstanceType.NotSupportDiskCategory | The instanceType of the specified instance does not support this disk category. | The specified instance type does not support the disk categories of the instance. Change the instance type and try again. For information about the disk categories that are supported by each instance type, see the instance family documentation. |
404 | InvalidImageId.NotFound | The specified ImageId does not exist. | The specified image does not exist in this account. Check whether the image ID is valid. |
404 | InvalidInstanceChargeType.NotFound | The InstanceChargeType does not exist in our records. | The specified instance billing method does not exist. |
404 | DependencyViolation.IoOptimized | The specified instancetype must be IoOptimized instance. | The instance type is not I/O optimized. |
404 | InvalidSystemDiskSize.LessThanImageSize | The specified parameter SystemDisk.Size is less than the image size. | The specified system disk size is smaller than the image size. |
404 | InvalidSystemDiskSize.LessThanMinSize | The specified parameter SystemDisk.Size is less than the minimum size. | The specified system disk size is smaller than the lower limit. |
404 | InvalidSystemDiskSize.ValueNotSupported | The specified parameter SystemDisk.Size is invalid. | Invalid SystemDisk.Size value. |
404 | InvalidInstanceType.Missing | The InstanceType parameter that is mandatory for processing the request is not provided. | Specify InstanceType. |
404 | InvalidNetworkType.ValueNotSupported | The specified parameter NetworkType is not valid. | Invalid NetworkType value. |
404 | InvalidDiskCategory.Missing | The DataDisk.1.Category parameter that is mandatory for processing the request is not provided. | You must specify DataDisk.1.Category. |
404 | Invalid.InstanceId.NotFound | The Instance provided does not exist. | The instance does not exist. |
404 | InvalidMarketImage.NotFound | The specified marketplace image does not exist, please change the imageId and try again. | The Alibaba Cloud Marketplace image does not exist. Change the ImageId value and try again. |
404 | InvalidDiskIds.NotPortable | The specified DiskId is not portable. | The specified disk is not removable. |
404 | InvalidSystemDisk.NotFound | The specified system disk does not exist. | The system disk does not exist. |
404 | InvalidResourceGroup.NotFound | The ResourceGroup provided does not exist in our records. | The resource group ID does not exist. |
500 | InternalError | The request processing has failed due to some unknown error. | An internal error occurred. Try again later. |
500 | InternalError | %s | An internal error occurred. |
For a list of error codes, see Service error codes.