Serverless Lambda Edge Pre Existing Cloudfront

A Serverless Framework plugin to create your Lambda@Edge against a pre-existing CloudFront.

Serverless Lambda Edge PreExisting CloudFront

A Serverless Framework plugin which associates Lambda@Edge against pre-existing CloudFront distributions.


You can install this plugin from npm registry.

$ npm install --save-dev serverless-lambda-edge-pre-existing-cloudfront

How it works

Configure serverless.yml

    handler: lambdaEdge/viewerRequest.handler
      - preExistingCloudFront:
          distributionId: xxxxxxx # CloudFront distribution ID you want to associate
          eventType: viewer-request # Choose event to trigger your Lambda function, which are `viewer-request`, `origin-request`, `origin-response` or `viewer-response`
          pathPattern: '*' # Specifying the CloudFront behavior
          includeBody: false # Whether including body or not within request

  - serverless-lambda-edge-pre-existing-cloudfront

Run deploy

$ serverless deploy

You can specify additional configurations a lambdaEdgePreExistingCloudFront value in the custom section of your serverless.yml file. A validStages value allows you to specify valid stage names for deploy Lambda@Edge.

    - staging
    - production
view on Github

Latest commit b2f54ec on Sep 24, 2017

New to serverless?

To get started, pop open your terminal & run:

npm install serverless -g