Hello,
I ran the CCF calculator (the CLI version) towards my team's AWS accounts and the carbon footprint was quite low for all services except AWS Lambda. There, the estimates seemed impossibly high, so I decided to look at a particular date for one of our accounts (the account with the least activity, to save some time) and go through the steps in the code manually. I also checked the documentation for some explanation of the calculations, and I did find some parts a bit puzzling.
So, the first thing I did was go to Cloudwatch insights and run the query
filter @type = "REPORT"
| fields datefloor(@timestamp, 1d) as Date, @duration/1000 as DurationInS, @memorySize/1000000 as MemorySetInMB, 2.12 * DurationInS/3600 * MemorySetInMB/1792 as wattsPerFunction
| stats sum(wattsPerFunction) as Watts by Date
| sort Date asc
against all lambda log groups for the day in question (2021-12-01).
So here my first question is: Shouldnt't it be called wattHoursPerFunction, and the end result wattHours, since the duration in hours is there in the calculation?
Anyway, the end result was that the number of watt hours was 59.5026
The number of kilowatt hours was then set as 59.5026 Wh * 1.13 (PuE for AWS) = 67.535451 (kWh)
This is the number that ended up in the results csv file when running the CLI app, under the
"Lambda kilowatt hours" column.
This I don't understand. The PuE is a unit-less factor as far as I'm aware, so how can something with the unit Wh multiplied by a unit-less factor get the unit kWh? Shouldn't the calculation be
(E(Wh) * PuE)/1000
with the result here being 0.06754?
Then the CO2e estimate was set as
67.535451 (kWh) * 0.000316 (grid emissions factor in AWS region eu-west-1 [metric ton / kWh]) = 0.021341 ton CO2e
This was the result in the csv file under the column
"Lambda metric tons CO2e
Emissions".
So the end result is 0.021341 ton CO2e, or 21.34 kg CO2e, for AWS Lambda in that account, whereas I think the result should be
0.067535451 (kWh) * 0.000316 (grid emissions factor in AWS region eu-west-1 [metric ton / kWh]) = 0.000021341 ton CO2e =
0.021341 kg CO2e
I.e. the end result is off by a factor of a thousand.
Am I in the wrong here? Did I misunderstand something, or is there indeed an error?
The reason I started digging was that the end result for all of the lambdas in our production account was a whopping 8 tons CO2e for just a week. That seemed awfully high, considering the specifics of our account.
Regards, Mathilda