Views the latest price of ECS resources.

Description

Before calling this action, you must submit a ticket to grant a permission. Otherwise, you may receive the InvalidAction failure.

When you query the prices for different types of resources, the required parameters are also different:

  • When the ResourceType parameter is set to instance, you must specify the InstanceType parameter.
  • When the ResourceType parameter is set to disk, you must specify the DataDisk 1. Category and DataDisk. 1. Size parameters. When you query the price of disks, the PriceUnit parameter can be set to Hour only, and the system only returns the Pay-As-You-Go price of the disks.
  • When you query the price of bandwidths, the system only returns the PayByTraffic price of bandwidths.

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. You can call DescribeRegions to view the latest regions of Alibaba Cloud.

Action String No DescribePrice

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

Amount Integer No 1

The number of ECS instances that you want to purchase. You can specify this parameter when you want to query the prices of multiple instances with certain specifications. Valid values: 1 to 1000.

Default value: 1.

DataDisk.N.Category String No cloud_ssd

The category of data disk N, valid range of N is 1 to 5. Valid values:

  • cloud: basic disk
  • cloud_efficiency: ultra disk
  • cloud_ssd: standard SSD
  • ephemeral_ssd: local SSD
  • cloud_essd: ESSD
DataDisk.N.Size Integer No 2000

The size of the data disk, valid range of N is 1 to 5. Unit: GiB. Valid values:

  • cloud: 5 to 2000
  • cloud_efficiency: 20 to 32768
  • cloud_ssd: 20 to 32768
  • cloud_essd: 20 to 32768
  • ephemeral_ssd: 5 to 800
ImageId String No centos_7_05_64_20G_alibase_20181212.vhd

The ID of the image to be used to create the instances. You can call DescribeImages to view the available images. If you do not specify the parameter, the system queries the price of the Linux images by default.

InstanceNetworkType String No vpc

The network type of the instance. Valid values:

  • classic
  • vpc

Default value: vpc.

InstanceType String No ecs.n1.tiny

The instance type. For more information, see Instance type families, or call DescribeInstanceTypes to query the latest instance types.

InternetChargeType String No PayByTraffic

The billing method of network bandwidth. Valid values:

  • PayByBandwidth: You are billed based on the fixed amount of bandwidth.
  • PayByTraffic: The billing method is based on actual traffic.

Default value: PayByTraffic.

InternetMaxBandwidthOut Integer No 5

The maximum value of public network outbound bandwidth. Unit: Mbit/s. Valid values: 0 to 100.

Default value: 0.

IoOptimized String No none

Indicates whether the instance is I/O optimized. Valid values:

  • none
  • optimized

If the value of the InstanceType parameter indicates a Generation I type, the instance is non-I/O optimized by default.

If the value of the InstanceType parameter does not indicate a Generation I type, the instance is I/O optimized by default.

Period Integer No 1

The billing duration of an ECS instance. Valid values:

  • The value range is 1 to 9 when the PriceUnit parameter is set to Month.
  • The value range is 1 to 3 when the PriceUnit parameter is set to Year.
  • The value is 1 when the PriceUnit parameter is set to Hour.

Default value: 1.

PriceUnit String No Year

The pricing unit for ECS instance usage. Valid values:

  • Month
  • Year
  • Hour: This is the default value.
ResourceType String No instance

The type of the resource. Valid values:

  • instance
  • disk
  • bandwidth

Default value: instance.

SystemDisk.Category String No cloud_ssd

The category of the system disk. When the InstanceType parameter is set to one of the Phased-out instance types and the IoOptimized parameter is set to none, the default value is cloud. In other cases, the default value is cloud_efficiency. Valid values:

  • cloud: basic disk
  • cloud_efficiency: ultra disk
  • cloud_ssd: standard SSD
  • ephemeral_ssd: local SSD
  • cloud_essd: ESSD
SystemDisk.Size Integer No 80

The size of the system disk. Unit: GiB. Valid values: 20 to 500.

The value of this parameter must be at least 20 GiB, or greater than or equal to the value of ImageSize. Default value: Max{40, the size of the specified image}.

Response parameters

Name Type Example Description
PriceInfo

An array of PriceInfoType data, including price and discounts.

└Price

The price.

└Currency String CNY

The currency unit.

└DetailInfos

The details of the price information.

└DiscountPrice Float 655.2

The discount.

└OriginalPrice Float 4368

The original price.

└Resource String instance

The name of the resource.

└SubRules

A subset of pricing rules.

└Description String Get 15% discount on 1-year subscription

The description of the rule subset.

└RuleId Long 587

The ID of the rule.

└TradePrice Float 3712.8

The transaction price.

└DiscountPrice Float 655.2

The discount.

└OriginalPrice Float 4368

The original price.

└TradePrice Float 3712.8

The transaction price, which is equal to the original price minus the discount.

└Rules

The promotion rules.

└Description String Get 15% discount on 1-year subscription

The description of the promotion rule.

└RuleId Long 587

The ID of the promotion rule.

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

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=DescribePrice
&RegionId=cn-hangzhou
&InstanceType=ecs.n1.tiny 
&<Common request parameters>

Successful response examples

XML format

<DescribePriceResponse>
  <RequestId>04F0F334-1335-436C-A1D7-6C044FE73368</RequestId> 
  <PriceInfo>
    <Price>
      <Currency> CNY </Currency>
      <DiscountPrice>655.2</DiscountPrice>
      <OriginalPrice>4368</OriginalPrice>
      <TradePrice>3712.8</TradePrice>
    </Price>
    <Rules>
      <Rule> 
        <Description> Get 15% discount on 1-year subscription</Description>
        <RuleId> ONE_YEAR_85_PERCENT </RuleId>
      </Rule>
    </Rules>
  </PriceInfo>
</DescribePriceResponse>

JSON format

{
	"PriceInfo":{
		"Price":{
			"DiscountPrice":655.2,
			"OriginalPrice":4368,
			"TradePrice":3712.8,
			"Currency":"CNY"
		},
		"Rules":{
			"Rule":[
				{
					"Description":"Get 15% discount on 1-year subscription",
					"Code":"ONE_YEAR_85_PERCENT"
				}
			]
		}
	},
	"RequestId":"04F0F334-1335-436C-A1D7-6C044FE73368"
}

Error codes

HTTP status code Error code Error message Description
400 InvalidInstanceType.ValueNotSupported The specified InstanceType does not exist or beyond the permitted range. The error message returned when the specified instance type is not supported
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 error message returned when the size of the specified data disk exceeds the upper limit.
400 InvalidDataDiskCategory.ValueNotSupported The specified parameter "DataDisk.n.Category" is not valid. The error message returned when the DataDisk.n.Category parameter is invalid.
403 OperationDenied The specified Image is disabled or is deleted. The error message returned when the specified image is disabled or deleted.
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 error message returned when the specified image from Alibaba Cloud Marketplace is unavailable.
400 InvalidDiskCategory.Mismatch The specified disk categories' combination is not supported. The error message returned when the combination of specified disk categories is not supported.
403 Forbbiden User not authorized to operate on the specified resource. The error message returned when you are not authorized to access the specified resource.
404 InvalidImageId.NotFound The specified ImageId does not exist. The error message returned when the specified image does not exist under this account. Check whether the image ID is correct.
403 InvalidDiskSize.TooSmall Specified disk size is less than the size of snapshot. The error message returned when the capacity of the specified disk 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 disk type does not support the specified operation.
404 InvalidInstanceChargeType.NotFound The InstanceChargeType does not exist in our records The error message returned when the specified instance type does not exist.
400 InvalidPeriod The specified period is not valid. The error message returned when the specified period is invalid.
400 InvalidDataDiskCategory.ValueNotSupported The specified parameter " DataDisk.n.Category " is not valid. The error message returned when the specified disk type is invalid.
400 InvalidSystemDiskCategory.ValueNotSupported The specified parameter " SystemDisk.Category " is not valid. The error message returned when the specified disk type is invalid.
403 InvalidDiskCategory.NotSupported The specified disk category is not support the specified instance type. The error message returned when the specified disk type does not support the instance type.
403 InvalidDiskCategory.NotSupported The upgrade operation of instance does not support this category of disk. The error message returned when the disks attached to the instance do not support instance specifications upgrades.
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 error message returned when the size of the specified data disk exceeds the upper limit.
404 InvalidSystemDiskSize.LessThanImageSize The specified parameter SystemDisk.Size is less than the image size. The error message returned when the size of the specified system disk is smaller than the image size.
403 InvalidParameter.ResourceOwnerAccount ResourceOwnerAccount is Invalid. The error message returned when the specified ResourceOwnerAccount parameter is invalid.
403 RegionUnauthorized There is no authority to create instance in the specified region. The error message returned when you are not authorized to create instances in the specified region.
404 InvalidSystemDiskSize.ValueNotSupported The specified parameter SystemDisk.Size is invalid. The error message returned when the specified value of the SystemDisk.Size parameter is invalid.
400 InstanceDiskNumber.LimitExceed The total number of specified disk in an instance exceeds. The error message returned when the number of disks attached to the instance exceeds the upper limit.
400 InvalidDiskCategory.ValueNotSupported The specified parameter "DiskCategory" is not valid. The error message returned when the specified DiskCategory parameter is invalid.
403 OperationDenied The resource is out of usage. The error message returned when the instance is not in the running state. Start the instance.
400 InvalidInternetMaxBandwidthOut.ValueNotSupported %s The error message returned when the setting of the InternetMaxBandwidthOut parameter is invalid.
400 InvalidDataDiskCategory.ValueNotSupported %s The error message returned when the parameter is not supported.
400 InvalidSystemDiskCategory.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 InvalidInternetChargeType.ValueNotSupported %s The error message returned when the parameter is not supported.
400 InvalidInstanceType.ValueNotSupported %s The error message returned when the instance type is incorrect.
403 InstanceType.Offline %s The error message returned when the instance type is unavailable.
500 InternalError %s The error message returned when an unknown internal error occurs.
400 InvalidSystemDiskSize.ValueNotSupported %s The error message returned when the parameter is not supported.
400 InvalidDataDiskSize.ValueNotSupported %s The error message returned when the parameter is not supported.
400 PriceNotFound The price of your queried resource is not available now, please try other resources. The error message returned when the price of the resource cannot be queried. Try again later.
400 InvalidResourceType.ValueNotSupported The specified parameter ResourceType is not valid. The error message returned when the specified resource type is invalid.
400 InvalidPriceUnit.ValueNotSupported The specified parameter PriceUnit is not valid. The error message returned when the specified pricing unit is invalid.
403 OperationDenied The specified parameter InstanceNetworkType is not authorized. The error message returned when the specified instance network type is unauthorized.
403 InvalidAmount.Malformed The specified parameter Amount is not valid. The error message returned when the format of the Amount parameter is invalid.
400 EncryptedOption.Conflict %s The error message returned when the parameter does not support encrypted disks.
404 Invalid.InstanceId.NotFound The Instance provided does not exist. The error message returned when the specified instance does not exist.
403 InvalidDiskSize.TooSmall Specified system disk size is less than the size of image The error message returned when the size of the system disk is smaller than that of the image.
404 InvalidMarketImage.NotFound The specified marketplace image does not exist, please change the imageId and try again. The error message returned when the specified image does not exist in Alibaba Cloud Marketplace.
400 IncorrectImageStatus The specified marketplace image is not available. The error message returned when the specified image from Alibaba Cloud Marketplace is unavailable.
403 InvalidChargeType.MarketImage The specified chargeType of marketplace image is invalid The error message returned when the billing method for the images from Alibaba Cloud Marketplace is not supported.
403 InvalidDiskCategory.NotSupported The specified disk category is not supported. The error message returned when the cloud disk type is not supported.

View error codes