Lookup table problem

70 views
Skip to first unread message
Assigned to mva...@thoughtworks.com by vfe.1695961...@thoughtworks.com

Maciej Strzelecki

unread,
Jul 6, 2022, 9:06:47 AM7/6/22
to Cloud Carbon Footprint
Dear all,
I am trying to use lookup table approach to calculate emissions in my project. However, the results of the calculations are different from what I see in the CCF app. Let's take AWS lambda service as an example. This is my Athena query:

SELECT
line_item_product_code as serviceName,
product_region as region,
line_item_usage_type as usageType,
pricing_unit as usageUnit,
product_vcpu as vCpus
FROM initialtestreport
WHERE line_item_line_item_type IN ('Usage', 'DiscountedUsage', 'SavingsPlanCoveredUsage')
AND line_item_usage_start_date >= DATE('2022-07-04')
AND line_item_usage_start_date <= DATE('2022-07-05')
GROUP BY 1, 2, 3, 4, 5

This is my lookup table data example:
serviceName region usageType usageUnit vCpus machineType kilowattHours co2e
AWSLambda us-east-1 Lambda-GB-Second seconds LOOKUP-AAA LOOKUP-BBB
AWSLambda us-east-1 Request Requests LOOKUP-CCC LOOKUP-DDD

This is my billing data example
line_item_product_code product_region line_item_usage_type pricing_unit product_vcpu line_item_usage_amount resource_tags_user_name bill_billing_entity bill_payer_account_id
AWSLambda us-east-1 Request Requests BILLING-AAA AWS XXXXXXX
AWSLambda us-east-1 Lambda-GB-Second seconds BILLING-BBB AWS XXXXXXX

Now, to estimate co2e emissions I am doing the following steps:

1. I take the first row from the billing table and look for the corresponding row in the lookup table. I multiply two values: STEP1 = BILLING-AAA * LOOKUP-DDD
2. I take the second row from the billing table and look for the corresponding row in the lookup table. I multiply two values: STEP2 = BILLING-BBB * LOOKUP-BBB
3. I make a sum: STEP1 + STEP2 = LAMBDA_SUM

Now I look in the CCF application and LAMBDA_SUM is about 10000 bigger than the value in CCF. Is my calculations correct? Where should I look for mistakes?
Reply all
Reply to author
Forward
0 new messages