AWS Lambda trigger not having cloudfront

Viewed 1691

I created a new lambda function but do not see cloudfront as an option in the Triggers. Does anybody know why that might be? Thanks

3 Answers

CloudFront's Lambda@Edge integration feature requires that the functions be written in Node.js. It isn't possible to trigger a function in another language directly from CloudFront.

You must create functions with the nodejs6.10 or nodejs8.10 runtime property.

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-requirements-limits.html#lambda-requirements-lambda-function-configuration

Of course, in the Node.js runtime environment, you have the AWS Javascript SDK available, so if you had a really compelling case, you could use that from a Javascript function to invoke another, different Lambda function written in a different language... but it's difficult to imagine a common case where that would make sense, because of the added latency and cost, but I have, for example, used this solution to allow Lambda@Edge to reach inside a VPC -- which can only be done by invoking a second Lambda function (which could be configured to have VPC access) from inside the first (which can't, because Lambda@Edge functions run in the region nearest to the viewer, rather than in a single region, so they will not run inside a VPC).

Related