2015-12-31 41 views
0

我在使用Python中的boto ec2查詢AWS定價。 首先,我正在使用get_all_reserved_instances_offerings, 查找所有提供的特定實例類型實例,然後針對上述返回的所有實例,我正在按「小時頻率」檢查金額和固定價格。我這段代碼做到這一點:爲什麼實例類型的價格顯示與原始AWS列表不同?

for ins in each_ins.recurring_charges: 
    if ins.frequency == 'Hourly': 
     print float(ins.amount) 
    print float(each_ins.fixed_price) 

each_ins.fixed_price打印前期正確

"d2.2xlarge": 3844.0, 

"m3.2xlarge": 1961.0, 

它顯示了正確的價格,如圖中紅色標記圖:

enter image description here

但ins.amount打印:

"d2.2xlarge": 0.438, 

"m3.2xlarge": 0.248, 

我認爲應該是0.8768,如上圖所示帶綠色標記。

回答

0

綠色框中的值是過去一年每小時的情況下,整體有效的成本(佔每小時收費標準比上年加上初始的前期成本分攤在一年即。)

然而,ins.amount價值是每月每小時收取的成本,忽略了最初的預先成本。從每月費用中粗略計算一個月後,每小時的費用爲〜0.444,與您所看到的值幾乎相當。

AWS says the following with respect to the continuing monthly charges:

*This is the average monthly payment over the course of the RI term. For each month, the actual monthly payment will equal the actual number of hours in that month multiplied by the hourly usage rate. The hourly usage rate is equivalent to the total average monthly payments over the term of the RI divided by the total number of hours (based on a 365 day year) over the term of the RI.

相關問題