- Create the project from the following template:
$ sls create --template-url https://github.com/danteinc/js-cloud-native-cookbook/tree/master/ch4/cdn-lambda --path cncb-cdn-lambda
- Navigate to the cncb-cdn-lambda directory with cd cncb-cdn-lambda.
- Review the file named serverless.yml with the following content:
service: cncb-cdn-lambdaplugins: - serverless-plugin-cloudfront-lambda-edgeprovider: name: aws runtime: nodejs8.10 ...functions: authorize: handler: handler.authorize memorySize: 128 timeout: 1 lambdaAtEdge: distribution: 'ApiDistribution' eventType: 'viewer-request' ...resources: Resources: Bucket: Type: AWS::S3::Bucket ApiDistribution: Type: AWS::CloudFront::Distribution Properties: DistributionConfig: ...
- Install ...