Assorted queries for AWS CloudWatch Insights
Last active
March 10, 2022 03:54
-
-
Save tkburns/0e17a5446695ef0250a9d4ffe77b2598 to your computer and use it in GitHub Desktop.
Assorted queries for AWS CloudWatch Insights
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# profile lambda memory usage | |
filter @type = "REPORT" | |
| fields | |
@requestId, | |
@timestamp, | |
@billedDuration, | |
@memorySize / 1024 / 1024 as provisonedMemoryMB, | |
@maxMemoryUsed / 1024 / 1024 as memoryUsedMB, | |
memoryUsedMB / provisonedMemoryMB * 100 as memoryUtilizationPercent, | |
provisonedMemoryMB - memoryUsedMB as overProvisionedMB | |
| sort by memoryUtilizationPercent desc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# groups invocation cost by lambda name & provisioned memory | |
# makes it easy to compare costs after tweaking a lambda's provisioned memory | |
filter @type = "REPORT" | |
| fields | |
substr(@log, 25) as name, | |
@billedDuration, | |
@memorySize / 1024 / 1024 as provisonedMemoryMB, | |
@billedDuration * provisonedMemoryMB / 1000 as cost | |
| stats | |
avg(@billedDuration) as avgDuration, | |
avg(cost) as avgCost | |
by | |
name, | |
provisonedMemoryMB | |
| sort by avgCost desc | |
#| sort by avgDuration desc | |
#| sort by provisonedMemoryMB, avgDuration desc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment