AWS cloudwatch insights queries

Here are some common useful queries for AWS insights working with lambda.
  • For cold start metrics.
filter @type "REPORT" |
parse @message /Init Duration: (?<init>\S+)/ |
stats count() as total, count(init) as coldStarts, 
median(init) as avgInitDuration, 
max(init) as maxInitDuration, 
avg(@maxMemoryUsed)/1000/1000 as memoryused 
by bin (30min)
  •  For Lambda memory size utilization metrics.
filter @type="REPORT"
| stats avg(@maxMemoryUsed/1024/1024) as mean_MemoryUsed,
min(@maxMemoryUsed/1024/1024) as min_MemoryUsed,
max(@maxMemoryUsed/1024/1024) as max_MemoryUsed,
percentile(@maxMemoryUsed/1024/102495) as Percentile95