You can use the AWS Lambda console or Amazon CloudFront console to add a trigger to your Lambda@Edge function.
Important
You can create triggers only for numbered versions of your function (not the $LATEST).
To add triggers for CloudFront events to a Lambda@Edge function
Sign in to the AWS Management Console and open the AWS Lambda console at https://console.aws.amazon.com/lambda/
. -
In the Region list at the top of the page, choose US East (N. Virginia).
-
On the Functions page, choose the name of the function that you want to add triggers for.
-
On the Function overview page, choose the Versions tab.
-
Choose the version that you want to add triggers to.
After you choose a version, the name of the button changes to Version: $LATEST or Version: version number.
-
Choose the Triggers tab.
-
Choose Add trigger.
-
For Trigger configuration, choose Select a source, enter
cloudfront
, and then choose CloudFront.Note
If you've already created one or more triggers, CloudFront is the default service.
-
Specify the following values to indicate when you want the Lambda function to execute.
-
Distribution – Choose the distribution that you want to add the trigger to.
-
Cache behavior – Choose the cache behavior that specifies the objects that you want to execute the function on.
Note
If you specify
*
for the cache behavior, the Lambda function deploys to the default cache behavior. -
CloudFront event – Choose the CloudFront event that causes the function to execute.
-
Include body – Select this check box if you want to access the request body in your function.
-
Confirm deploy to Lambda@Edge – Select this check box so that AWS Lambda replicates the function to AWS Regions globally.
-
-
Choose Add.
The function starts to process requests for the specified CloudFront events when the updated CloudFront distribution is deployed. To determine whether a distribution is deployed, choose Distributions in the navigation pane. When a distribution is deployed, the value of the Status column for the distribution changes from Deploying to the date and time of deployment.