Skip to content

Commit

Permalink
Merge pull request #3 from KristijanEftimov/main
Browse files Browse the repository at this point in the history
Updated lambda function to summarize the cost if the week has days fr…
  • Loading branch information
kristijaneftimovpcg authored Aug 5, 2024
2 parents 755bfb9 + 81b0276 commit eedcccf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ def get_actual_cost(start_date, end_date):
Granularity='MONTHLY',
Metrics=['UnblendedCost'],
)

total_actual_cost = float(actual_cost['ResultsByTime'][0]['Total']['UnblendedCost']['Amount'])
total_actual_cost = 0
for cost in actual_cost['ResultsByTime']:
total_actual_cost += float(cost['Total']['UnblendedCost']['Amount'])
return round(total_actual_cost, 2)

#Function to get the forecast dates for the current month
Expand Down

0 comments on commit eedcccf

Please sign in to comment.