Domain name for API request: cvm.tencentcloudapi.com.
This API is used to query the price of creating instances. You can only use this API for instances whose configuration is within the purchase limit. For more information, see RunInstances.
A maximum of 10 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
Parameter Name | Required | Type | Description |
---|---|---|---|
Action | Yes | String | Common Params. The value used for this API: InquiryPriceRunInstances. |
Version | Yes | String | Common Params. The value used for this API: 2017-03-12. |
Region | Yes | String | Common Params. For more information, please see the list of regions supported by the product. |
Placement | Yes | Placement | Location of the instance. You can use this parameter to specify the attributes of the instance, such as its availability zone and project. Note: Placement is required when LaunchTemplate is not specified. If both the parameters are passed in, Placement prevails. |
ImageId | Yes | String | Image ID in the format of img-xxx . There are three types of images: You can obtain the available image IDs in the following ways: public images , custom images , and shared images , log in to the CVM console to query the information. ImageId in the response.Note: ImageId is required when LaunchTemplate is not specified. If both the parameters are passed in, ImageId prevails. |
InstanceChargeType | No | String | The instance billing method. Default value: POSTPAID_BY_HOUR. |
InstanceChargePrepaid | No | InstanceChargePrepaid | Details of the monthly subscription, including the purchase period, auto-renewal. It is required if the InstanceChargeType is PREPAID . |
InstanceType | No | String | The instance model. Different resource specifications are specified for different models. For specific values, call DescribeInstanceTypeConfigs to retrieve the latest specification list or refer to Instance Types. If the parameter is not specified, S1.SMALL1 will be used by default. |
SystemDisk | No | SystemDisk | System disk configuration of the instance. If this parameter is not specified, the default value will be used. |
DataDisks.N | No | Array of DataDisk | Data disk configuration of the instance. If the parameter is not specified, no data disk will be purchased by default. If you want to purchase data disks, you can specify 21 data disks, including up to 1 LOCAL_BASIC data disk or LOCAL_SSD data disk and up to 20 CLOUD_BASIC data disks, CLOUD_PREMIUM data disks, or CLOUD_SSD data disks. |
VirtualPrivateCloud | No | VirtualPrivateCloud | VPC configurations (VPC ID, subnet ID, etc). If it’s not specified, the classic network will be used by default. If a VPC IP is specified in this parameter, the InstanceCount can only be 1. |
InternetAccessible | No | InternetAccessible | Configuration of public network bandwidth. If it’s not specified, 0 Mbps is used by default. |
InstanceCount | No | Integer | Number of instances to purchase. Value range: 1 (default) to 100. It cannot exceed the remaining CVM quota of the user. For more information on quota, see Restrictions on CVM Instance Purchase. |
InstanceName | No | String | Instance name.{R:x} , numbers [x, x+n-1] will be generated, where n represents the number of instances purchased. For example, you specify a pattern string server_{R:3} . If you purchase only one instance, the instance will be named server_3 ; if you purchase two, they will be named server_3 and server_4 . You can specify multiple pattern strings in the format of {R:x} .1, 2...n , where n represents the number of instances purchased. For example, if you purchase two instances with the name server_ , the instance names will be server_1 and server_2 . |
LoginSettings | No | LoginSettings | Login settings of the instance. You can use this parameter to set the login method, password, and key of the instance, or keep the original login settings of the image. By default, a random password will be generated and sent to you via the Message Center. |
SecurityGroupIds.N | No | Array of String | Security groups to which the instance belongs. To obtain the security group IDs, you can call DescribeSecurityGroups and look for the sgld fields in the response. If this parameter is not specified, the instance will not be associated with any security group by default. |
EnhancedService | No | EnhancedService | Enhanced services. You can use this parameter to specify whether to enable services such as Cloud Security and Cloud Monitor. If this parameter is not specified, Cloud Monitor and Cloud Security will be enabled by default. |
ClientToken | No | String | A unique string supplied by the client to ensure that the request is idempotent. Its maximum length is 64 ASCII characters. If this parameter is not specified, the idempotency of the request cannot be guaranteed. For more information, see Ensuring Idempotency. |
HostName | No | String | Hostname of Cloud Virtual Machine. |
TagSpecification.N | No | Array of TagSpecification | The tag description list. This parameter is used to bind a tag to a resource instance. A tag can only be bound to CVM instances. |
InstanceMarketOptions | No | InstanceMarketOptionsRequest | The market options of the instance. |
HpcClusterId | No | String | HPC cluster ID. |
CpuTopology | No | CpuTopology | Information about the CPU topology of an instance. If not specified, it is determined by system resources. |
LaunchTemplate | No | LaunchTemplate |
Parameter Name | Type | Description |
---|---|---|
Price | Price | Price of the instance with the specified configurations. |
RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
This example shows you how to inquire about the price for purchasing 1 instance with the following configurations. Availability zone: Shanghai Zone 2; billing mode: monthly subscription for 1 month, with auto-renewal enabled; image ID: img-pmqg1cw7; model: 64C256G standard (S5.16XLARGE256); system disk: 50 GB premium cloud disk; data disk: 100 GB premium cloud disk; network type: VPC; public network billing: pay-as-you-go by traffic on an hourly basis; public network bandwidth cap: 10 Mbps; public IP address: randomly allocated; instance name: QCLOUD-TEST; login password: Qcloud@TestApi123++; Cloud Monitor: enabled; Cloud Security: enabled.
POST / HTTP/1.1
Host: cvm.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: InquiryPriceRunInstances
<Common request parameters>
{
"SystemDisk": {
"DiskSize": 50,
"DiskType": "CLOUD_PREMIUM"
},
"InstanceCount": 1,
"Placement": {
"Zone": "ap-shanghai-2"
},
"LoginSettings": {
"Password": "Qcloud@TestApi123++"
},
"ImageId": "img-pmqg1cw7",
"InstanceChargeType": "PREPAID",
"EnhancedService": {
"SecurityService": {
"Enabled": true
},
"MonitorService": {
"Enabled": true
}
},
"InternetAccessible": {
"PublicIpAssigned": true,
"InternetChargeType": "TRAFFIC_POSTPAID_BY_HOUR",
"InternetMaxBandwidthOut": 10
},
"InstanceChargePrepaid": {
"RenewFlag": "NOTIFY_AND_AUTO_RENEW",
"Period": 1
},
"InstanceName": "QCLOUD-TEST",
"InstanceType": "S5.16XLARGE256",
"DataDisks": [
{
"DiskSize": 100,
"DiskType": "CLOUD_PREMIUM"
}
]
}
{
"Response": {
"Price": {
"InstancePrice": {
"DiscountPrice": 1804.9,
"OriginalPriceThreeYear": 0.0,
"DiscountOneYear": 0.0,
"UnitPrice": 0.0,
"UnitPriceThirdStep": 0.0,
"OriginalPriceFiveYear": 0.0,
"Discount": 0.0,
"DiscountFiveYear": 0.0,
"UnitPriceDiscountThirdStep": 0.0,
"UnitPriceSecondStep": 0.0,
"OriginalPrice": 8884.5,
"DiscountThreeYear": 0.0,
"UnitPriceDiscountSecondStep": 0.0,
"UnitPriceDiscount": 0.0,
"DiscountPriceFiveYear": 0.0,
"OriginalPriceOneYear": 0.0,
"ChargeUnit": "HOUR",
"DiscountPriceThreeYear": 0.0,
"DiscountPriceOneYear": 0.0
},
"BandwidthPrice": {
"DiscountPrice": 0.0,
"OriginalPriceThreeYear": 0.0,
"DiscountOneYear": 0.0,
"UnitPrice": 0.8,
"UnitPriceThirdStep": 0.0,
"OriginalPriceFiveYear": 0.0,
"Discount": 0.0,
"DiscountFiveYear": 0.0,
"UnitPriceDiscountThirdStep": 0.0,
"UnitPriceSecondStep": 0.0,
"OriginalPrice": 0.0,
"DiscountThreeYear": 0.0,
"UnitPriceDiscountSecondStep": 0.0,
"UnitPriceDiscount": 0.52,
"DiscountPriceFiveYear": 0.0,
"OriginalPriceOneYear": 0.0,
"ChargeUnit": "HOUR",
"DiscountPriceThreeYear": 0.0,
"DiscountPriceOneYear": 0.0
}
},
"RequestId": "65b9edac-bca6-496b-a404-29f503b32495"
}
}
This example shows you how to inquire about the price for purchasing an instance in Shanghai Zone 2 with the image ID img-pmqg1cw7
. Only the required Placement.Zone
and ImageId
parameters are provided. The other parameters use system default values.
POST / HTTP/1.1
Host: cvm.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: InquiryPriceRunInstances
<Common request parameters>
{
"Placement": {
"Zone": "ap-shanghai-2"
},
"ImageId": "img-pmqg1cw7"
}
{
"Response": {
"Price": {
"InstancePrice": {
"DiscountPrice": 0.0,
"OriginalPriceThreeYear": 0.0,
"DiscountOneYear": 0.0,
"UnitPrice": 16.09,
"UnitPriceThirdStep": 16.09,
"OriginalPriceFiveYear": 0.0,
"Discount": 0.0,
"DiscountFiveYear": 0.0,
"UnitPriceDiscountThirdStep": 3.33,
"UnitPriceSecondStep": 16.09,
"OriginalPrice": 0.0,
"DiscountThreeYear": 0.0,
"UnitPriceDiscountSecondStep": 3.33,
"UnitPriceDiscount": 3.33,
"DiscountPriceFiveYear": 0.0,
"OriginalPriceOneYear": 0.0,
"ChargeUnit": "HOUR",
"DiscountPriceThreeYear": 0.0,
"DiscountPriceOneYear": 0.0
},
"BandwidthPrice": {
"DiscountPrice": 0.0,
"OriginalPriceThreeYear": 0.0,
"DiscountOneYear": 0.0,
"UnitPrice": 0.8,
"UnitPriceThirdStep": 0.0,
"OriginalPriceFiveYear": 0.0,
"Discount": 0.0,
"DiscountFiveYear": 0.0,
"UnitPriceDiscountThirdStep": 0.0,
"UnitPriceSecondStep": 0.0,
"OriginalPrice": 0.0,
"DiscountThreeYear": 0.0,
"UnitPriceDiscountSecondStep": 0.0,
"UnitPriceDiscount": 0.52,
"DiscountPriceFiveYear": 0.0,
"OriginalPriceOneYear": 0.0,
"ChargeUnit": "xx",
"DiscountPriceThreeYear": 0.0,
"DiscountPriceOneYear": 0.0
}
},
"RequestId": "65b9edac-bca6-496b-a404-29f503b32495"
}
}
This example shows you how to inquire about the price for purchasing 1 instance with the following configurations. Availability zone: Shanghai Zone 2; billing mode: pay-as-you-go on an hourly basis; image ID: img-pmqg1cw7; model: 64C256G standard (S5.16XLARGE256); system disk: 50 GB premium cloud disk; data disk: 100 GB premium cloud disk; network type: VPC; public network billing: pay-as-you-go by traffic on an hourly basis; public network bandwidth cap: 10 Mbps; public IP address: randomly allocated; instance name: QCLOUD-TEST; login password: Qcloud@TestApi123++; Cloud Monitor: enabled; Cloud Security: enabled.
POST / HTTP/1.1
Host: cvm.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: InquiryPriceRunInstances
<Common request parameters>
{
"SystemDisk": {
"DiskSize": 50,
"DiskType": "CLOUD_PREMIUM"
},
"InstanceCount": 1,
"Placement": {
"Zone": "ap-shanghai-2"
},
"LoginSettings": {
"Password": "Qcloud@TestApi123++"
},
"ImageId": "img-pmqg1cw7",
"InstanceChargeType": "POSTPAID_BY_HOUR",
"EnhancedService": {
"SecurityService": {
"Enabled": true
},
"MonitorService": {
"Enabled": true
}
},
"InternetAccessible": {
"PublicIpAssigned": true,
"InternetChargeType": "TRAFFIC_POSTPAID_BY_HOUR",
"InternetMaxBandwidthOut": "10"
},
"InstanceName": "QCLOUD-TEST",
"InstanceType": "S5.16XLARGE256",
"DataDisks": [
{
"DiskSize": 100,
"DiskType": "CLOUD_PREMIUM"
}
]
}
{
"Response": {
"Price": {
"InstancePrice": {
"DiscountPrice": 0.0,
"OriginalPriceThreeYear": 0.0,
"DiscountOneYear": 0.0,
"UnitPrice": 0.2,
"UnitPriceThirdStep": 0.1,
"OriginalPriceFiveYear": 0.0,
"Discount": 0.0,
"DiscountFiveYear": 0.0,
"UnitPriceDiscountThirdStep": 0.06,
"UnitPriceSecondStep": 0.12,
"OriginalPrice": 0.0,
"DiscountThreeYear": 0.0,
"UnitPriceDiscountSecondStep": 0.06,
"UnitPriceDiscount": 0.08,
"DiscountPriceFiveYear": 0.0,
"OriginalPriceOneYear": 0.0,
"ChargeUnit": "HOUR",
"DiscountPriceThreeYear": 0.0,
"DiscountPriceOneYear": 0.0
},
"BandwidthPrice": {
"DiscountPrice": 0.0,
"OriginalPriceThreeYear": 0.0,
"DiscountOneYear": 0.0,
"UnitPrice": 0.0,
"UnitPriceThirdStep": 0.0,
"OriginalPriceFiveYear": 0.0,
"Discount": 0.0,
"DiscountFiveYear": 0.0,
"UnitPriceDiscountThirdStep": 0.0,
"UnitPriceSecondStep": 0.0,
"OriginalPrice": 0.0,
"DiscountThreeYear": 0.0,
"UnitPriceDiscountSecondStep": 0.0,
"UnitPriceDiscount": 0.0,
"DiscountPriceFiveYear": 0.0,
"OriginalPriceOneYear": 0.0,
"ChargeUnit": "HOUR",
"DiscountPriceThreeYear": 0.0,
"DiscountPriceOneYear": 0.0
}
},
"RequestId": "65b9edac-bca6-496b-a404-29f503b32495"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Error Code | Description |
---|---|
AccountQualificationRestrictions | Your account failed the qualification verification. |
AuthFailure.CamRoleNameAuthenticateFailed | Role name authentication failed. |
FailedOperation.DisasterRecoverGroupNotFound | The specified spread placement group does not exist. |
FailedOperation.IllegalTagKey | The tag key contains invalid characters. |
FailedOperation.IllegalTagValue | The tag value contains invalid characters. |
FailedOperation.InquiryPriceFailed | Price query failed. |
FailedOperation.SnapshotSizeLargerThanDataSize | The snapshot size is larger than the disk capacity. You need a larger disk space. |
FailedOperation.TagKeyReserved | The tag key specified in the request is reserved for the system. |
FailedOperation.TatAgentNotSupport | This image is not a Linux&x86_64 image. |
InstancesQuotaLimitExceeded | You are trying to create more instances than your remaining quota allows. |
InternalError.TradeUnknownError | Internal error. |
InvalidClientToken.TooLong | The specified ClientToken exceeds the maximum length of 64 bytes. |
InvalidHostId.Malformed | Invalid CDH ID . The specified CDH ID has an invalid format. For example, host-1122 has an invalid ID length. |
InvalidHostId.NotFound | The specified HostId does not exist, or does not belong to your account. |
InvalidImageId.Malformed | Invalid image ID format. |
InvalidImageId.NotFound | The image cannot be found. |
InvalidInstanceName.TooLong | The specified InstanceName exceeds the maximum length of 60 bytes. |
InvalidInstanceType.Malformed | The specified InstanceType parameter has an invalid format. |
InvalidParameter.EdgeZoneMissInternetAccessible | When specifying the CTCC/CUCC/CMCC public IP address parameter for edge zones, you need to first specify the public IP address parameter for the primary IP address. |
InvalidParameter.HostIdCustomizedInstanceTypeNotSupport | The specified CDH host does not support custom instance specifications. |
InvalidParameter.HostIdInstanceTypeNotSupport | The specified CDH host does not support the instance model specifications. |
InvalidParameter.HostIdStandardInstanceTypeNotSupport | The specified CDH host does not support standard instance specifications. |
InvalidParameter.InstanceImageNotSupport | This API does not support instance images. |
InvalidParameter.InstanceTypeSupportedHostNotFound | No CDH host supports the specified instance specifications. |
InvalidParameter.InternetAccessibleNotSupported | Unable to set the public network bandwidth. |
InvalidParameter.OnlySupportForEdgeZone | Only edge zones support this parameter. |
InvalidParameter.SnapshotNotFound | The specified snapshot does not exist. |
InvalidParameter.SpecialParameterForSpecialAccount | This parameter can only be used when the allowlist feature is enabled. |
InvalidParameterCombination | The parameter combination is invalid. |
InvalidParameterValue | Incorrect parameter value. |
InvalidParameterValue.BandwidthPackageIdMalformed | The shared bandwidth package ID is invalid. Please provide a standard shared bandwidth package ID in the format similar to bwp-xxxxxxxx. In this format, the letter x stands for a lowercase character or a number. |
InvalidParameterValue.BandwidthPackageIdNotFound | The specified bandwidth package does not exist. |
InvalidParameterValue.BandwidthPackageIspNotMatch | The ISP of the bandwidth package does not match the ISP parameter. |
InvalidParameterValue.BandwidthPackageZoneNotMatch | The availability zone of the bandwidth package does not match the specified availability zone. |
InvalidParameterValue.CloudSsdDataDiskSizeTooSmall | The minimum capacity of a SSD data disk is 100 GB. |
InvalidParameterValue.DuplicateTags | Duplicate tags. |
InvalidParameterValue.InstanceTypeNotFound | The specified instance type does not exist. |
InvalidParameterValue.InstanceTypeNotSupportHpcCluster | This type of instances cannot be added to the HPC cluster. |
InvalidParameterValue.InstanceTypeRequiredHpcCluster | The HPC cluster needs to be specified for the high-performance computing instance. |
InvalidParameterValue.InsufficientPrice | The bid is lower than the market price. |
InvalidParameterValue.InvalidAppIdFormat | Invalid AppID |
InvalidParameterValue.InvalidImageFormat | A RAW image cannot be used to create a CVM. Choose another image. |
InvalidParameterValue.InvalidImageId | The image does not support this operation. |
InvalidParameterValue.InvalidImageOsName | The operating system of the specified image is not available in the current region. |
InvalidParameterValue.InvalidImageState | The image has another ongoing task. Please check and try again later. |
InvalidParameterValue.InvalidTimeFormat | Incorrect time format. |
InvalidParameterValue.InvalidUserDataFormat | Incorrect UserData format. Use the Base64-encoded format. |
InvalidParameterValue.IspNotSupportForEdgeZone | Edge zones do not support this ISP. |
InvalidParameterValue.IspValueRepeated | Duplicate ISP parameter value specified. |
InvalidParameterValue.LimitExceeded | The number of parameter values exceeds the limit. |
InvalidParameterValue.Range | Invalid parameter value: invalid parameter value range. |
InvalidParameterValue.RequiredLocationImage | |
InvalidParameterValue.SnapshotIdMalformed | Invalid snapshot ID. Provide a snapshot ID in the format of snap-xxxxxxxx, where the letter x refers to lowercase letter or number. |
InvalidParameterValue.TagKeyNotFound | The specified tag does not exist |
InvalidParameterValue.TagQuotaLimitExceeded | Tag quota limit exceeded. |
InvalidParameterValue.ZoneNotSupported | The availability zone does not support this operation. |
InvalidPassword | Invalid password. The specified password does not meet the password requirements. For example, the password length does not meet the requirements. |
InvalidPeriod | Invalid period. Valid values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36]; unit: month. |
InvalidPermission | This operation is not supported for the account. |
InvalidProjectId.NotFound | Invalid project ID: the specified project ID does not exist. |
InvalidZone.MismatchRegion | The specified zone does not exist. |
LimitExceeded.DisasterRecoverGroup | The quota of the specified placement group is insufficient. |
LimitExceeded.InstanceEniNumLimit | Reached the upper limit of the ENIs for the instance. |
MissingParameter | Missing parameter. |
MissingParameter.MonitorService | The instance type must have Cloud Monitor enabled. |
ResourceInsufficient.CloudDiskUnavailable | The parameters of cloud disk do not meet the specification. |
ResourceInsufficient.DisasterRecoverGroupCvmQuota | The number of instances exceeded the quota limit of spread placement groups. |
ResourceNotFound.HpcCluster | The HPC cluster does not exist. |
ResourceNotFound.NoDefaultCbs | No default CBS resources are available. |
ResourceNotFound.NoDefaultCbsWithReason | No default CBS resources are available. |
ResourceUnavailable.InstanceType | This instance type is unavailable in the availability zone. |
ResourcesSoldOut.SpecifiedInstanceType | The specified instance type is sold out. |
UnsupportedOperation.BandwidthPackageIdNotSupported | The specified instance or network cannot use the bandwidth package. |
UnsupportedOperation.InstanceTypeNotSupportJumboFrame | The instance type does not support setting the EnableJumboFrame status. |
UnsupportedOperation.InvalidDisk | The specified disk is not supported. |
UnsupportedOperation.InvalidRegionDiskEncrypt | Encrypted disks are not available in the selected regions. |
UnsupportedOperation.NoInstanceTypeSupportSpot | This instance type does not support spot instances. |
UnsupportedOperation.NotSupportImportInstancesActionTimer | Failed to configure the scheduled action for the current instance. |
UnsupportedOperation.OnlyForPrepaidAccount | Only a prepaid account supports this operation. |
UnsupportedOperation.SpotUnsupportedRegion | Spot instance is not supported in this region. |
UnsupportedOperation.UnderwritingInstanceTypeOnlySupportAutoRenew | For an underwriting instance, RenewFlag can only be set to NOTIFY_AND_AUTO_RENEW . |
UnsupportedOperation.UnsupportedInternationalUser | This operation is not available for Tencent Cloud International users. |
문제 해결에 도움이 되었나요?