aborilov
Intern
Intern
  • UID5752
  • Fans0
  • Follows0
  • Posts3
Reads:143Replies:5

Instance price

Created#
More Posted time:Jun 7, 2018 22:38 PM
Hello!
Is there a way to get instance price from API?
I found SpotPriceHistory, but that is not what I need

hanneng
Assistant Engineer
Assistant Engineer
  • UID3277
  • Fans3
  • Follows0
  • Posts48
1st Reply#
Posted time:Jun 9, 2018 8:13 AM
are you referring to API Gateway?

refer to API gateway document here
https://www.alibabacloud.com/product/api-gateway

Pricing
https://www.alibabacloud.com/product/api-gateway#pricing

JohnHanley
Intern
Intern
  • UID5606
  • Fans0
  • Follows0
  • Posts27
2nd Reply#
Posted time:Jun 11, 2018 9:47 AM
Spot instances pricing is determined by bidding. If your bid wins then you will know the price. There is no API to get the current price as the price changes instant by instant and could be out of date by the time you then created your bid. AWS has the same limitation.

Solution: use spot history, determine your maximum bid, win the bid and display the price.

Faxin
Intern
Intern
  • UID5791
  • Fans0
  • Follows0
  • Posts1
3rd Reply#
Posted time:Jun 15, 2018 17:05 PM

There are two APIs for querying ECS prices: DescribePriceRequest and DescribePriceResponse.
But only whitelisted users can use it. Please
submit a ticket to request for permissons. Hope it helps.

aborilov
Intern
Intern
  • UID5752
  • Fans0
  • Follows0
  • Posts3
4Floor#
Posted time:Jun 18, 2018 22:23 PM
I'm now trying to get all prices for all instance types in all zones, I loop through regions, getting its zones and then loop through the zone.AvailableInstanceTypes and trying to get SpotPriceHistory for this instance type, the weird part, that I'm getting a different number of prices, sometimes I'm getting empty SpotPriceHistory for some instance type, but next time I successfully receive a list of SpotPriceHistory.
Any ideas why this happening?

aborilov
Intern
Intern
  • UID5752
  • Fans0
  • Follows0
  • Posts3
5Floor#
Posted time:Jun 18, 2018 22:26 PM
Faxin:There are two APIs for querying ECS prices: DescribePriceRequest and DescribePriceResponse.
But only whitelisted users ...
回到原帖
as I understand I can get only one price for specified instance, but I have thousands and thousands of instances, so I think it's better for me to get all prices for all instance types in all regions, and periodically refresh that list, what do you think?
Guest