Skip to content

Instantly share code, notes, and snippets.

@jkrnak
Created November 21, 2018 17:25
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 jkrnak/172d620732a41c5321cb2492da38dfc4 to your computer and use it in GitHub Desktop.
Save jkrnak/172d620732a41c5321cb2492da38dfc4 to your computer and use it in GitHub Desktop.
Create Lambda@Edge project
service: LambdaAtEdge
provider:
name: aws
runtime: nodejs8.10
region: us-east-1
resources:
Resources:
LambdaAtEdgeRole:
Type: AWS::IAM::Role
Properties:
RoleName: lambda-at-edge-role
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
# we give access to the Lambda and Lambda@Edge service to assume our role
Service:
- lambda.amazonaws.com
- edgelambda.amazonaws.com
Action: sts:AssumeRole
ManagedPolicyArns:
# we are giving access to write to cloudwatch logs, managed policies are very permissive
# consider writing your own more restrictive policies
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
functions:
cache-control:
handler: handler.handler # <filename>.<exported-function>
role: LambdaAtEdgeRole # we reference the resource we created earlier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment