- Newest
- Most votes
- Most comments
The behavior you're experiencing with Lambda@Edge functions and their log groups is actually expected and different from regular Lambda functions. For Lambda@Edge functions, the log groups are created in the region where the function is executed, which can be any of the CloudFront edge locations around the world.
When you create a Lambda@Edge function, the log group name includes the region code where the function is executed. This is why you're seeing the log group name as /aws/lambda/us-east-1.<function-name> instead of just /aws/lambda/<function-name>.
The "undefined" log group name you're seeing (/aws/lambda/undefined) is likely because the function hasn't been executed yet in any edge location. Once the function is triggered and executed at an edge location, you should see log groups created with the appropriate region codes.
If you want to have more control over the log group name or its properties, you can create a custom log group and specify it in the logGroup property of the EdgeFunctionProps. However, keep in mind that Lambda@Edge functions will still create region-specific log groups when executed in different edge locations.
To resolve the "undefined" issue and ensure proper naming, you can try the following:
- Make sure you're giving a unique and descriptive ID to each EdgeFunction in your CDK code.
- You may need to trigger the Lambda@Edge function (by accessing your CloudFront distribution) to see the actual log groups created in various regions.
- If you want to aggregate logs from all regions, you can look into using CloudWatch Logs Insights to query across multiple log groups.
Remember that the behavior for Lambda@Edge functions differs from regular Lambda functions in terms of log group creation and naming due to their distributed nature across edge locations.
Sources
default cloudwatch loggroup name contains undesired region code. | AWS re:Post
interface EdgeFunctionProps · AWS CDK
answered a year ago
Relevant content
asked 2 years ago
- AWS OFFICIALUpdated 2 years ago

The issue isn't that it's including the region code in the log group name, it's that the log group name is
aws/lambda/undefined.I'm giving a unique ID to each edge function (
EdgeFunction${edgeFunction.name}-${stage}-$region}), and the log group is stillaws/lambda/undefinedeven after the edge functions are triggered.