Skip to content

Instantly share code, notes, and snippets.

@magnetikonline
Last active December 16, 2024 03:16
Show Gist options
  • Save magnetikonline/0cf1793c2e9ca1204dc9ddb0e759517d to your computer and use it in GitHub Desktop.
Save magnetikonline/0cf1793c2e9ca1204dc9ddb0e759517d to your computer and use it in GitHub Desktop.
List AWS Lambda@Edge log groups across regions.

List AWS Lambda@Edge log groups across regions

AWS Lambda@Edge functions, which run under CloudFront at multiple edge locations require associated Lambda functions to exist within each AWS region.

By design, this means CloudWatch Log groups produced by Lambda@Edge functions will exist across these regions.

This Bash script will query for all log groups associated to Lambda@Edge functions for each enabled region of the current AWS account to hopefully help determine where logs are going to and/or exist.

#!/bin/bash -e
function main {
local IFS=$'\n'
local region
for region in $(aws ec2 describe-regions --output text --query "Regions[].[RegionName]"); do
echo "Region: $region"
aws \
--region "$region" \
logs describe-log-groups \
--log-group-name-prefix "/aws/lambda/us-east-1." \
--output text \
--query "logGroups[].[logGroupName]"
done
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment