Content Deep Dive
Creating a Secure Media CDN with CloudFront and Lambda@Edge (Part III)
Blog post from Contentful
Post Details
Company
Date Published
Author
Leonardo Freitas dos Santos
Word Count
1,003
Language
English
Hacker News Points
-
Summary
This is part III of a series on building a CloudFront distribution that serves S3 Media, performs on-demand image transformation, and authenticates incoming requests. The goal is to streamline error responses and add authentication to the distribution. A new origin-response Lambda@Edge function is created to rewrite error responses, while a viewer-request Lambda@Edge function is added for authentication. The functions are attached to CloudFront using Terraform, and the code is compiled using Rollup. The final result allows for normalized error responses and authentication, with the next step being to add logging and monitoring metrics.