The common mental model: point CloudFront at an S3 bucket, serve static assets faster. This is correct and useful, but incomplete.
SellTrove's CloudFront distribution does six things simultaneously: serves static assets from S3, proxies API requests to Lambda with edge caching, runs Lambda@Edge for authentication validation before requests hit the origin, enforces rate limiting via WAF rules, and handles SSL for the main domain and customer subdomains.
None of these required custom infrastructure. They required reading the documentation carefully.
Before you build custom infrastructure for any of these concerns, check whether CloudFront already solves it.
— Dick Bassey | DevDick | 2024