Skip to content

Instantly share code, notes, and snippets.

@magnetikonline
Last active October 26, 2023 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • 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 Logs 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/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