Pranav Soni
Pranav Soni

Reputation: 39

AWS: Hosting GoLang Lambda functions on Cloudfront

I have a Lambda function in GoLang, I want to have CDN on it for region based quick access (I think Cloudfront can help me do that on AWS).

Researched so far:

Cloudfront package in GoLang

There exists this official Go package for Cloudfront, this might be helpful: https://docs.aws.amazon.com/sdk-for-go/api/service/cloudfront/ and https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/cloudfront.

Expectations

I just want a way to host my existing Lambda functions on a CDN either using Cloudfront or something else.

Upvotes: 0

Views: 36

Answers (1)

Gernot Glawe
Gernot Glawe

Reputation: 53

A few misunderstandings; there is no such thing as "hosting Lambda on Cloudfront".

  1. Lambda functions at CDN "at the edge" are meant for working on each request of the CloudFront distribution. The restrictions apply, these Functions do not support GO
  2. The go cloudfront sdk is to manage cloudfront services
  3. If you want to access a Lambda function from "everywhere", may be you are looking for Lambda function urls: https://docs.aws.amazon.com/lambda/latest/dg/urls-invocation.html
  4. Usually you would use API Gateway to access Lambda functions.

More to using GO Lambda on AWS: https://www.go-on-aws.com/

Upvotes: 1

Related Questions