0

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.

2 Answers 2

1

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/

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the response. I just want to host my Go Lambda function on a CDN, the way how Lambda@Edge is there. You clearly stated that these Functions do not support GO. url-invocations that you shared is something else. I wonder if there is a workaround to use Go Lambda function with CDN on AWS. The main goal here is to have quick access to users from any region on my Go Lambda functions. Cheers!
0

Ok, this is a misunderstanding between „hosting a lambda on cdn“ and cloudfront functions.

Cloudfront functions are functions to be applied to each request of a website.

Lambda functions on aws always are located in a region like us-east-1

With cloudfront you can just cache responses. Two different things!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.