MA Singh
MA Singh

Reputation: 71

AWS Lambda trigger not having cloudfront

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

Upvotes: 6

Views: 2629

Answers (3)

maximpa
maximpa

Reputation: 1988

As per AWS current documentation:

Make sure that you’re in the US-East-1 (N. Virginia) Region. You must be in this Region to create Lambda@Edge functions.

See: AWS Tutorial: Creating a Simple Lambda@Edge Function

Select AWS region

Upvotes: 8

Michael - sqlbot
Michael - sqlbot

Reputation: 179094

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).

Upvotes: 0

Bharathi
Bharathi

Reputation: 501

You cannot add from Lambda console. For adding trigger for cache behavior, you need to do it from CloudFront console.

Its is explained in detail here - https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-edge-add-triggers-cf-console.html

Upvotes: 0

Related Questions