调用DescribePrice查询云服务器ECS资源的最新价格。
接口说明
- 查询不同类型资源的价格时,必需参数也有所不同,具体说明如下:
- 参数
ResourceType=instance
时,您必须同时指定参数InstanceType
。 - 参数
ResourceType=disk
时,您必须同时指定参数DataDisk.1.Category
和DataDisk.1.Size
。查询disk
资源的价格时,只返回云盘按量付费的价格,即参数PriceUnit
只能取值为Hour
。 - 查询
ResourceType=ddh
时,您必须同时指定参数DedicatedHostType
。 - 查询
ResourceType=ElasticityAssurance
时,必须同时指定参数InstanceType
。 - 查询
ResourceType=CapacityReservation
时,必须同时指定参数InstanceType
。
- 参数
- 查询
ResourceType=bandwidth
时,只返回按流量计费(PayByTraffic
)的价格。 - 参数
ResourceType=instance
时,仅支持查询四块以内数据盘的价格。 - 默认查询付费方式(
ChargeType
)为按量付费(PostPaid
)的价格,您可以通过指定PriceUnit
参数查询云服务器ECS不同计费周期的价格。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 |
类型 |
是否必选 |
示例值 |
描述 |
Action | String | 是 | DescribePrice |
系统规定参数。取值:DescribePrice。 |
RegionId | String | 是 | cn-hangzhou |
地域ID。您可以调用DescribeRegions查看最新的阿里云地域列表。 |
ResourceType | String | 否 | instance |
目标资源的类型。取值范围:
默认值:instance。 |
ImageId | String | 否 | centos_7_05_64_20G_alibase_20181212.vhd |
仅当参数ResourceType的值为instance时,该参数生效。 镜像ID,表示启动实例时希望装载的运行环境。您可以调用DescribeImages查询您可用的镜像资源。如果不指定,默认查询Linux系统镜像的价格。 |
InstanceType | String | 否 | ecs.g6.large |
实例的资源规格。参数 |
DedicatedHostType | String | 否 | ddh.c5 |
专有宿主机的规格。您可以调用DescribeDedicatedHostTypes接口获得最新的专有宿主机规格表。 |
IoOptimized | String | 否 | optimized |
查询的实例是否为I/O优化实例。取值范围:
当InstanceType为系列I的规格时,默认值为none。 当InstanceType为非系列I的规格时,默认值为optimized。 |
InstanceNetworkType | String | 否 | vpc |
实例的网络类型。取值范围:
默认值:vpc。 |
InternetChargeType | String | 否 | PayByTraffic |
网络带宽计费方式。取值范围:
默认值:PayByTraffic。 |
InternetMaxBandwidthOut | Integer | 否 | 5 |
公网出带宽最大值,单位为Mbit/s(Megabit per second)。取值范围:0~100。 默认值:0。 |
SystemDisk.Category | String | 否 | cloud_ssd |
系统盘的云盘种类。取值范围:
参数默认值说明:
说明 查询系统盘价格时,必须同时指定 |
SystemDisk.Size | Integer | 否 | 80 | 系统盘大小,单位为GiB。取值范围:20~500。 默认值:max{20, 参数ImageId对应的镜像大小}。 |
SystemDisk.PerformanceLevel | String | 否 | PL1 |
系统盘类型为ESSD云盘时,区分性能等级。仅当 PL0。 PL1(默认)。 PL2。 PL3。 |
DataDisk.1.Size | Integer | 否 | 2000 |
为提高扩展性,建议您使用 |
DataDisk.1.Category | String | 否 | cloud_ssd |
为提高扩展性,建议您使用 |
DataDisk.1.PerformanceLevel | String | 否 | PL1 |
为提高扩展性,建议您使用 |
DataDisk.2.Size | Integer | 否 | 200 |
为提高扩展性,建议您使用 |
DataDisk.2.Category | String | 否 | cloud_ssd |
为提高扩展性,建议您使用 |
DataDisk.2.PerformanceLevel | String | 否 | PL1 |
为提高扩展性,建议您使用 |
DataDisk.3.Size | Integer | 否 | 2000 |
为提高扩展性,建议您使用 |
DataDisk.3.Category | String | 否 | cloud_ssd |
为提高扩展性,建议您使用 |
DataDisk.3.PerformanceLevel | String | 否 | PL1 |
为提高扩展性,建议您使用 |
DataDisk.4.Size | Integer | 否 | 2000 |
为提高扩展性,建议您使用 |
DataDisk.4.Category | String | 否 | cloud_ssd |
为提高扩展性,建议您使用 |
DataDisk.4.PerformanceLevel | String | 否 | PL1 |
为提高扩展性,建议您使用 |
Period | Integer | 否 | 1 |
云服务器ECS的计费时长。取值范围:
默认值:1。 |
PriceUnit | String | 否 | Year |
查询云服务器ECS不同计费周期的价格。取值范围:
|
Amount | Integer | 否 | 1 |
查询批量购买某种配置的云服务器ECS的价格。取值范围:1~1000。 默认值:1。 |
OfferingType | String | 否 | All Upfront |
预留实例券的付款类型。取值范围:
|
InstanceAmount | Integer | 否 | 100 |
在一个实例规格内,需要预留的实例的总数量。 取值范围:1~1000。 |
Scope | String | 否 | Zone |
预留实例券的范围。取值范围:
默认值:Region。 |
Platform | String | 否 | Linux |
实例使用的镜像的操作系统类型。取值范围:
|
Capacity | Integer | 否 | 1024 |
容量大小,单位为GiB。 |
AssuranceTimes | String | 否 | Unlimited |
弹性保障的总次数。取值:Unlimited,目前仅支持在服务生效期内的无限次模式。 默认值:Unlimited。 |
InstanceCpuCoreCount | Integer | 否 | 1024 |
弹性保障内支持实例的vCPU总数量。调用API时系统会根据用户指定的InstanceType换算出需要弹性保证内支持实例的数量(向上取整)。 说明 当调用API查询弹性保障价格时,参数InstanceCoreCpuCount和InstanceAmount只能指定其中一个。 |
Isp | String | 否 | cmcc | 互联网服务运营商,取值范围:
|
InstanceTypeList.N | String | 否 | ecs.c6.xlarge |
实例规格。目前仅支持无限次保障服务设置单个实例规格。 |
SpotStrategy | String | 否 | NoSpot |
按量付费实例的抢占策略。取值范围:
默认值:NoSpot。 说明 当 |
SpotDuration | Integer | 否 | 1 | 抢占式实例的保留时长,单位为小时。取值范围:0~6。
默认值:1。 |
ZoneId | String | 否 | cn-hagzhou-i |
可用区ID。 说明 抢占式实例不同可用区价格可能不同,查询抢占式实例价格时,建议传入ZoneId查询指定可用区的抢占式实例价格。 |
DataDisk.N.Category | String | 否 | cloud_ssd | 第N块数据盘的云盘种类。取值范围:
N的取值范围:1~16。 |
DataDisk.N.Size | Long | 否 | 2000 |
第N块数据盘的容量大小,内存单位为GiB。取值范围:
N的取值范围:1~16。 |
DataDisk.N.PerformanceLevel | String | 否 | PL1 |
第N块数据盘类型为ESSD云盘时,区分性能等级。仅当
N的取值范围:1~16。 |
SchedulerOptions.DedicatedHostId | String | 否 | dh-bp67acfmxazb4p**** |
仅当参数ResourceType的值为instance时,该参数生效。 专有宿主机ID。您可以通过DescribeDedicatedHosts 查询专有宿主机ID列表。 |
返回数据
名称 |
类型 |
示例值 |
描述 |
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
请求ID。 |
PriceInfo | Object |
价格信息类型(Price),包括价格和优惠规则。 |
|
Rules | Array of Rule |
活动规则。 |
|
Rule | |||
Description | String | 买满1年,立享官网价格8.5折优惠。 |
活动规则描述。 |
RuleId | Long | 587 |
活动规则ID。 |
Price | Object |
价格。 |
|
OriginalPrice | Float | 4368 |
原价。 |
ReservedInstanceHourPrice | Float | 1 |
0预付或部分预付的预留实例券的小时价。 |
DiscountPrice | Float | 655.2 |
折扣。 |
Currency | String | CNY |
货币单位。 中国站:CNY。 国际站:USD。 |
TradePrice | Float | 3712.8 |
最终价,为原价减去折扣。 |
DetailInfos | Array of ResourcePriceModel |
价格的详细信息。 说明 该返回值正在邀测中,暂未开放使用。 | |
ResourcePriceModel | |||
Resource | String | instance | 资源名称。 |
OriginalPrice | Float | 4368 |
原价。 |
DiscountPrice | Float | 655.2 |
折扣价。 |
TradePrice | Float | 3712.8 |
成交价。 |
SubRules | Array of Rule |
定价规则子集。 |
|
Rule | |||
Description | String | 买满1年,立享官网价格8.5折优惠 |
规则子集描述。 |
RuleId | Long | 587 |
活动规则ID。 |
示例
请求示例
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
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
04F0F334-1335-436C-A1D7-6C044FE73368
CNY
655.2
0
4368
3712.8
买满1年,立享官网价格8.5折优惠。
ONE_YEAR_85_PERCENT
JSON
格式
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" : "买满1年,立享官网价格8.5折优惠。",
"RuleId" : "ONE_YEAR_85_PERCENT"
} ]
}
}
}
错误码
HttpCode |
错误码 |
错误信息 |
描述 |
400 | InvalidSpotAuthorized | The specified Spot param is unauthorized. | 指定的 SpotDuration 参数值未获得授权。 |
400 | InvalidInstanceType.ValueUnauthorized | The specified InstanceType is not authorized. | 指定的实例规格未授权使用。 |
400 | InvalidInstanceType.ValueNotSupported | The specified InstanceType does not exist or beyond the permitted range. | 您指定的实例规格不存在,或者您没有权限操作此规格的实例。 |
400 | InvalidInternetChargeType.ValueNotSupported | The specified InternetChargeType is not valid. | 暂不支持指定的网络付费类型的实例,请确认相关参数是否正确。 |
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. | 指定的 DataDisk.n.Size 超出允许范围,或者快照的容量超过指定磁盘类别的大小限制。 |
400 | InvalidParameter.Conflict | The specified image does not support the specified instance type. | 指定的镜像不能用于指定的实例规格。 |
400 | InvalidIoOptimizedValue.ValueNotSupported | IoOptimized value not supported. | 不支持指定的I/O优化值。 |
400 | InvalidPeriod | The specified period is not valid. | 指定的时段不合法。 |
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. | 指定的 DataDisk.n.Size 超出允许范围,或者快照的容量超过了指定磁盘类别的大小限制。 |
400 | InvalidInternetMaxBandwidthOut.ValueNotSupported | The specified vm bandwidth is not valid. | 指定的虚拟机带宽无效。 |
400 | InvalidSystemDiskCategory.ValueNotSupported | The specified parameter SystemDisk.Category is not valid. | 指定的SystemDisk.Category不合法。 |
400 | InvalidInternetMaxBandwidthOut.ValueNotSupported | The specified parameter Bandwidth is not valid. | 指定的 Bandwidth 不合法。 |
400 | InstanceDiskNumber.LimitExceed | The total number of specified disk in an instance exceeds. | 实例下磁盘数目超过限制。 |
400 | InvalidInternetMaxBandwidthOut.ValueNotSupported | %s | 参数 InternetMaxBandwidthOut 无效。 |
400 | InvalidDataDiskCategory.ValueNotSupported | %s | 指定的数据磁盘类型无效。%s为变量,将根据调用API的实际情况动态返回错误信息。 |
400 | InvalidSystemDiskCategory.ValueNotSupported | %s | 当前操作不支持此系统磁盘类型。 |
400 | InvalidParameter.Conflict | %s | 您输入的参数无效,请检查参数之间是否冲突。%s为变量,将根据调用API的实际情况动态返回错误信息。 |
400 | InvalidInternetChargeType.ValueNotSupported | %s | 该实例不支持指定的 InternetChargeType。 |
400 | InvalidInstanceType.ValueNotSupported | %s | 该操作暂不支持指定的实例类型。 |
400 | RegionUnauthorized | %s | 该地域未被授权。%s为变量,将根据调用API的实际情况动态返回错误信息。 |
400 | InvalidSystemDiskSize.ValueNotSupported | %s | 当前操作不支持设置的系统盘大小。 |
400 | InvalidDataDiskSize.ValueNotSupported | %s | 指定的数据盘容量无效。%s为变量,将根据调用API的实际情况动态返回错误信息。 |
400 | Throttling | Request was denied due to request throttling. | 请求被流控。 |
400 | PriceNotFound | The price of your queried resource is not available now, please try other resources. | 未找到价格,请修改相应的参数值重试。 |
400 | InvalidResourceType.ValueNotSupported | The specified parameter ResourceType is not valid. | 指定的资源类型不合法。 |
400 | InvalidPriceUnit.ValueNotSupported | The specified parameter PriceUnit is not valid. | 指定的单价不合法。 |
400 | InvalidInternetMaxBandwidthOut.ValueNotSupported | The specified parameter InternetMaxBandwidthOut is not valid. | 指定的 InternetMaxBandwidthOut 参数不合法。 |
400 | EncryptedOption.Conflict | %s | 参数不支持(加密盘)。%s为变量,将根据调用API的实际情况动态返回错误信息。 |
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. | 指定的镜像为阿里云市场镜像。此镜像的售卖已经结束。更多信息请联系镜像服务提供商。 |
400 | InvalidAssuranceTimes.NotSupported | The value of AssuranceTimes is not supported. | AssuranceTimes参数值不支持。 |
400 | InvalidParameter.Platform | The specified parameter Platform is invalid. | 指定的 Platform 参数非法。 |
400 | InvalidOperation.InstanceRenewWithDowngradeInPlan | The operation is denied due to the specified instance has renew with downgrade record in plan. | 存在未生效的续费降配订单。订单生效前不允许此操作。 |
403 | ImageNotSubscribed | The specified image has not be subscribed. | 指定的镜像未在云市场镜像中订阅。 |
403 | OperationDenied | The specified Image is disabled or is deleted. | 指定的镜像被禁用或被删除。 |
403 | InvalidSystemDiskCategory.ValueUnauthorized | The disk category is not authorized. | 该磁盘类别未经授权。 |
403 | InstanceDiskCategoryLimitExceed | The total size of specified disk category in an instance exceeds. | 磁盘种类总容量超过实例限制。 |
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. | 指定的市场镜像不可用,或者指定的用户定义镜像包含产品代码,因为它基于从市场订购的镜像,并且市场中包含完全相同的产品代码的镜像已被删除。 |
403 | QuotaExceed.PortableCloudDisk | The quota of portable cloud disk exceeds. | 可卸载磁盘数量已达上限。 |
403 | Forbbiden | User not authorized to operate on the specified resource. | 用户未被授权操作指定的资源。 |
403 | InstanceDiskNumLimitExceed | The number of specified disk in an instance exceeds. | 实例下磁盘数目超过限制。 |
403 | IoOptimized.NotSupported | The specified image is not support IoOptimized Instance. | 指定的镜像不支持 I/O 优化型实例。 |
403 | ImageNotSupportInstanceType | The specified image don’t support the InstanceType instance. | 指定的镜像不支持选定实例规格的实例。 |
403 | InvalidDiskSize.TooSmall | Specified disk size is less than the size of snapshot. | 指定的磁盘容量小于快照容量。 |
403 | OperationDenied | The type of the disk does not support the operation. | 此磁盘种类不支持指定的操作。 |
403 | InvalidDiskCategory.Mismatch | The specified disk categories combination is not supported. | 不支持的磁盘种类搭配。 |
403 | InvalidDiskCategory.NotSupported | The specified disk category is not support the specified instance type. | 指定的磁盘种类不支持该实例规格。 |
403 | InvalidDiskCategory.NotSupported | The upgrade operation of instance does not support this category of disk. | 实例的升级操作不支持此类磁盘。 |
403 | InvalidParameter.ResourceOwnerAccount | ResourceOwnerAccount is Invalid. | 指定的 ResourceOwnerAccount 不合法。 |
403 | RegionUnauthorized | There is no authority to create instance in the specified region. | 用户未被授权在指定的地域创建实例。 |
403 | OperationDenied | The resource is out of usage. | 该实例不在运行状态,请您启动实例或检查操作是否合理。 |
403 | InstanceType.Offline | %s | 实例规格因停售、供货不足等原因,不支持该操作。 |
403 | OperationDenied | The specified parameter InstanceNetworkType is not authorized. | 用户未被授权指定的实例网络类型。 |
403 | InvalidAmount.Malformed | The specified parameter Amount is not valid. | 参数 Amount 格式错误。 |
403 | InvalidDiskIds.NotFound | Some of the specified disks do not exist. | 指定的磁盘不存在。 |
403 | InvalidDiskCategory.NotSupported | The specified disk category is not supported. | 指定的云盘类型不支持当前操作。 |
403 | PrePaidInstance.Expired | The prePaid instance has expired. | 包年包月实例已到期。 |
403 | InvalidAction.Unauthorized | The specified action is not valid. | 指定的操作无效。 |
403 | InvalidInstanceType.NotSupportDiskCategory | The instanceType of the specified instance does not support this disk category. | 指定的实例规格(InstanceType)不支持当前实例的云盘类别。请尝试更换其它实例规格。关于实例规格支持的云盘类型,请参见实例规格族文档。 |
404 | InvalidImageId.NotFound | The specified ImageId does not exist. | 指定的镜像在该用户账号下不存在,请您检查镜像 ID 是否正确。 |
404 | InvalidInstanceChargeType.NotFound | The InstanceChargeType does not exist in our records. | 指定的实例计费方式不存在。 |
404 | DependencyViolation.IoOptimized | The specified instancetype must be IoOptimized instance. | 指定的实例规格必须为I/O优化实例,请您检查实例规格是否正确。 |
404 | InvalidSystemDiskSize.LessThanImageSize | The specified parameter SystemDisk.Size is less than the image size. | 指定的 SystemDisk.Size 小于镜像大小。 |
404 | InvalidSystemDiskSize.LessThanMinSize | The specified parameter SystemDisk.Size is less than the minimum size. | 指定的 SystemDisk.Size 低于最小值。 |
404 | InvalidSystemDiskSize.ValueNotSupported | The specified parameter SystemDisk.Size is invalid. | 指定的 SystemDisk.Size 不合法。 |
404 | InvalidInstanceType.Missing | The InstanceType parameter that is mandatory for processing the request is not provided. | InstanceType 参数为必填参数。 |
404 | InvalidNetworkType.ValueNotSupported | The specified parameter NetworkType is not valid. | 指定的网络类型不合法。 |
404 | InvalidDiskCategory.Missing | The DataDisk.1.Category parameter that is mandatory for processing the request is not provided. | 没有指定数据盘类型。 |
404 | Invalid.InstanceId.NotFound | The Instance provided does not exist. | 指定的实例不存在。 |
404 | InvalidMarketImage.NotFound | The specified marketplace image does not exist, please change the imageId and try again. | 指定的市场镜像不存在,请更改参数后重试。 |
404 | InvalidDiskIds.NotPortable | The specified DiskId is not portable. | 指定的磁盘是不可移植的。 |
404 | InvalidSystemDisk.NotFound | The specified system disk does not exist. | 指定的系统盘不存在。 |
404 | InvalidResourceGroup.NotFound | The ResourceGroup provided does not exist in our records. | 资源组并不在记录中。 |
500 | InternalError | The request processing has failed due to some unknown error. | 内部错误,请重试。 |
500 | InternalError | %s | 内部错误。 |
访问错误中心查看更多错误码。
腾讯云1折,限时活动,即将结束: 马上收藏
同尘科技为腾讯云授权服务中心。
购买腾讯云产品享受折上折,更有现金返利。同意关联立享优惠
转转请注明出处:https://www.yunxiaoer.com/151526.html