(Originally published elsewhere in 2019), Where are the AWS CloudFront Lambda@Edge logs and metrics.
Where are the AWS CloudFront Lambda@Edge logs and metrics?
You’ve created a lambda@Edge function to view or influence the http request/response using a Lambda function, but you cannot see any hits when looking at the monitoring tab in the function definition within AWS Lambda. Is it being hit? Here’s how to find out.
Lambda@Edge
I’d created a lambda@edge function bound to a CloudFront distribution and to a specific origin event. In my instance it was to modify the default root object in a request URI for a static site hosted in AWS S3 which is fronted by CloudFront.
You’ve looked at the metrics in Lambda after CloudFront status for the distribution is Deployed
It looks like the function is not being triggered, why is that. Well, go over to CloudFront, look at the metrics tab and select the Lambda@Edge function, and you will see the region where the function is being triggered from, which you wouldn’t be able to see by changing regions on the console.
Here’s an example:
Take a look at which regions through hovering over
It looks I’m hitting Sydney, so the best place to go is the CloudWatch logs in Sydney. Take a look in the console by changing regions to Sydney, look at the Log Groups and there are my logs. The same metrics as seen in the CloudFront metrics is available in the CloudWatch metrics.
Originally published elsewhere on 08 July, 2019.