Skip to content

Instantly share code, notes, and snippets.

@gabidobo
Created March 2, 2023 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabidobo/baa8e0c0f4132c53271a753b952688c7 to your computer and use it in GitHub Desktop.
Save gabidobo/baa8e0c0f4132c53271a753b952688c7 to your computer and use it in GitHub Desktop.
Example Serverless config file to deploy to Lambda@Edge
service: eleventy-lambda-demo
frameworkVersion: '3'
provider:
name: aws
runtime: nodejs18.x
stage: prod
iam:
role:
statements:
- Effect: Allow
Action:
- logs:CreateLogStream
- logs:CreateLogGroup
- logs:PutLogEvents
Resource: "arn:aws:logs:*:*:log-group:/aws/*/*"
functions:
demo:
handler: index.handler
events:
- cloudFront:
eventType: origin-request
origin: s3://BUCKET_NAME.s3.amazonaws.com
pathPattern: /hello*
resources:
Resources:
IamRoleLambdaExecution:
Type: "AWS::IAM::Role"
Properties:
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
- edgelambda.amazonaws.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment