Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving existing lambda edge to Serverless Framework

I have a Lambda Edge attached to a CloudFront distribution. What I want to do is use Serverless Framework to publish the lambda (instead of manually uploading files and click on "Deploy to Lambda@Edge"). What I've tried to do, looking at the serverless documentation, is add this yml file to the project and run the deployment script

service: cloudfront-service

provider:
  name: aws
  runtime: nodejs10.x

functions:
  cfLambda:
    handler: index.handler
    events:
      - cloudFront:
        eventType: origin-request
        origin: <CloudFront-Origin-ID>

This deployed the Lambda but it didn't attached it to CloudFront (it hasn't been published and there is no versions or triggers related). So how can I do this, using an existing CloudFront distribution?

like image 894
Jimi Avatar asked Sep 27 '26 20:09

Jimi


1 Answers

This plugin @silvermine/serverless-plugin-cloudfront-lambda-edge will not help if you want to use an existing cloud front distribution. It is only helpful if you are going to create a new one. This issue has been already reported and as per the forum, this functionality they are not supporting.

like image 190
Sheshaj Awasthi Avatar answered Sep 30 '26 15:09

Sheshaj Awasthi