@@ -26,7 +26,17 @@ class EC2Generator(AWSGenerator):
26
26
27
27
INSTANCE_TYPES = (
28
28
# NOTE: Each tuple represents
29
- # (instance type, physical_cores, vCPUs, memory, storage, family, cost, rate, savings, description)
29
+ # (instance type,
30
+ # physical_cores,
31
+ # vCPUs,
32
+ # memory,
33
+ # storage,
34
+ # family,
35
+ # cost,
36
+ # rate,
37
+ # Reserved_instances,
38
+ # savings,
39
+ # description)
30
40
(
31
41
"m5.large" ,
32
42
"1" ,
@@ -39,6 +49,7 @@ class EC2Generator(AWSGenerator):
39
49
"0.045" ,
40
50
1 ,
41
51
False ,
52
+ False ,
42
53
"${cost} per On Demand Linux {inst_type} Instance Hour" ,
43
54
),
44
55
(
@@ -53,6 +64,7 @@ class EC2Generator(AWSGenerator):
53
64
"0.17" ,
54
65
1 ,
55
66
False ,
67
+ False ,
56
68
"${cost} per On Demand Linux {inst_type} Instance Hour" ,
57
69
),
58
70
(
@@ -67,6 +79,7 @@ class EC2Generator(AWSGenerator):
67
79
"0.099" ,
68
80
1 ,
69
81
False ,
82
+ False ,
70
83
"${cost} per On Demand Linux {inst_type} Instance Hour" ,
71
84
),
72
85
(
@@ -81,6 +94,7 @@ class EC2Generator(AWSGenerator):
81
94
"0.067" ,
82
95
1 ,
83
96
False ,
97
+ False ,
84
98
"${cost} per On Demand Linux {inst_type} Instance Hour" ,
85
99
),
86
100
)
@@ -125,6 +139,7 @@ def __init__(self, start_date, end_date, currency, payer_account, usage_accounts
125
139
instance_type .get ("rate" ),
126
140
instance_type .get ("saving" ),
127
141
instance_type .get ("amount" , "1" ),
142
+ instance_type .get ("reserved_instance" , False ),
128
143
instance_type .get ("negation" , False ),
129
144
"${cost} per On Demand Linux {inst_type} Instance Hour" ,
130
145
)
@@ -142,6 +157,7 @@ def _update_data(self, row, start, end, **kwargs):
142
157
rate ,
143
158
saving ,
144
159
amount ,
160
+ reserved_instance ,
145
161
negation ,
146
162
description ,
147
163
) = self ._instance_type
@@ -204,6 +220,18 @@ def _update_data(self, row, start, end, **kwargs):
204
220
# Overwrite lineItem/LineItemType for items with applied Savings plan
205
221
if saving is not None :
206
222
row ["lineItem/LineItemType" ] = "SavingsPlanCoveredUsage"
223
+ # Overwrite lineitem/LineItemType for RI's discount usage
224
+ if reserved_instance :
225
+ row ["lineItem/LineItemType" ] = "DiscountedUsage"
226
+ row ["lineItem/UnblendedCost" ] = 0
227
+ row ["lineItem/UnblendedRate" ] = 0
228
+ row ["lineItem/BlendedCost" ] = 0
229
+ row ["lineItem/BlendedRate" ] = 0
230
+ row ["lineItem/LineItemDescription" ] = f"{ inst_type } reserved instance applied"
231
+ row ["pricing/publicOnDemandCost" ] = "convertible"
232
+ row ["pricing/publicOnDemandRate" ] = "No Upfront"
233
+ row ["savingsPlan/SavingsPlanEffectiveCost" ] = None
234
+ row ["savingsPlan/SavingsPlanRate" ] = None
207
235
208
236
if negation :
209
237
row ["lineItem/LineItemType" ] = "SavingsPlanNegation"
0 commit comments