Measures the cold starts in total invocation including function name and memory size

Measures the cold starts in total invocation including function name and memory size.

CloudWatch Log Insights snippet that measures the cold starts in total invocation including function name and memory size

filter @type = "REPORT" and @message like /(?i)(Init Duration)/
|parse @message /^REPORT.*Init Duration: (?.*) ms.*/
| parse @log /^.*/aws/lambda/(?.*)/
| fields @memorySize / 1000000 as memorySize
| stats count() as coldStarts, avg(initDuration) as avgInitDuration, max(initDuration) as maxInitDuration
by functionName, memorySize

                                


< Back to snippets

GitHub icon View this snippet on GitHub


Running the CloudWatch snippet

Click on the button below to open up the snippet directly into your AWS account.

Manually running the CloudWatch snippet

2. Select Logs, and then choose Logs Insights.
3. In the Select log group(s) drop down, choose one or more log groups to query.
4. Copy snippet into query text area.
5. Click "Run Query"

Created by:

Julian Wood

Julian Wood

Julian is a developer advocate at AWS who loves helping developers learn how serverless and AI technologies can transform the way they build and run applications in the cloud.

Follow on LinkedIn