Lambda cold starts count and init duration

Cloudwatch Log Insights snippet that returns the number of cold starts and init duration.

Uses CloudWatch Insights to query a given log group and returns the number of Lambda cold starts and the init duration bucketed by 5 minutes.

filter @type="REPORT" and ispresent(@initDuration)
| stats count() as coldStarts, avg(@initDuration), min(@initDuration), max(@initDuration) by bin(5m)
                                


< 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:

Maciej Radzikowski

Maciej Radzikowski

Software Developer and Architect, doing serverless on AWS and blogging about it.

Follow on LinkedIn

Christopher Osborn

Christopher Osborn

Software Engineer with a focus on serverless technologies.