Published on

Find the most expensive Lambda function invocations with CloudWatch Logs Insights

Authors
Tired of constantly switching between AWS Console tabs? 🤕
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 a laser-focused view of your AWS API Gateway, Lambda and other resources - all in a single app.

Logs screen