0

If you are let's say creating multiple functions (call them prime functions) for an app and they use the same code for their work. If you then extract the same code and make it its own function (sub-functions) and use it, are you charged for these sub-functions when you call the prime functions?

For example, if I am sending an email on different occasions to users. So, I make a new function that can only be called from inside the prime function, let's say an HTTP request. But the email function is never exposed to the HTTP request directly. So, when I use a function that in turn uses this email function, am I charged for just one invocation or for both, the HTTP request function and email function.

I know that they incur costs when they use the compute but the question is in terms of invocation?

1 Answers1

2

If your function that is suppose to send email is called from the prime function. Then yes, since both the functions have been invoked.

And, you will be charged for each lambda's duration separately.

One easy to find your costs would be just to look up for cloudwatch logs of these lambda. Every log line with type=REPORT is equivalent to 1 invocation and it will also mention the memory configured and duration billed.

These are what AWS considers to bill you.

Lunarantic
  • 51
  • 4