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