Lambda@Edge to-Go 🥤

Using the Golang AWS SDK to create a Lambda@Edge function

Flo Sloot
5 min readJun 30, 2020
Living on the edge with lambda ;) | Pixabay

Lambda vs. Lambda@Edge

You might have guessed it; the only difference here is @Edge. And it’s literally at the edge. That is, Lambda@Edge is a service specifically made to execute Lambda function at Cloudfront edge locations.

These Lambda functions are usually used to redirects, route A/B tests, or override response headers.

We at Stackers.io use them to serve hundreds of frontend applications on multiple environments (Prod/Stage/Dev/PR-preview) according to the subdomain from a single CDN; because frugality ;)

Creating Lambda@Edge at AWS

Judging by the number of Google entries, Stackoverflow questions, and AWS tutorials that can be found when searching for “How to create Lambda@Edge,” I think the most common way to create a function and adding a trigger is through the AWS console

AWS Lambda creation UI

or using Terraform to set up all of the required infrastructures.

--

--