(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

lamda-edge-function-monitoring-a - Architect Forward (architectFWD™)

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:

lamda-edge-function-monitoring-b - Architect Forward (architectFWD™)

lamda-edge-function-monitoring-c - Architect Forward (architectFWD™)

Take a look at which regions through hovering over

lamda-edge-function-monitoring-d - Architect Forward (architectFWD™)

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.

Architect Forward (architectFWD™)


Originally published elsewhere on 08 July, 2019.

Quintes van Aswegen

Quintes van Aswegen

24+ years experience in solving business problems and maximising opportunities through technology in a variety of industries, public and private sector internationally. I founded architectFWD™ to provide knowledge and trusted advice in the areas of strategy, technology, cloud and digital to enable organisations to become Digital Leaders.