Published on

Find the most expensive Lambda function invocations with CloudWatch Logs Insights

Authors
Tired of using AWS Console? 🤕
Time to boost your productivity with Cloudash — an AWS desktop client.

AWS Lambda pricing is based on the number of requests and the duration of the function execution. As such - the shorter the execution, the cheaper it is.

In this post, we will show you how to use CloudWatch Logs Insights to find the most expensive Lambda function invocations.

filter @type = "REPORT"
| fields @requestId, @billedDuration
| sort by @billedDuration desc

@billedDuration is the key param here - it is the duration of the function execution in milliseconds. The @requestId is the unique identifier of the function invocation which you can use to find the corresponding log entry.

Tired of switching between AWS console tabs? 😒

Cloudash provides clear access to CloudWatch logs and metrics, to help you make quicker decisions.
Try it for free:

Logs screen