Open
Description
As the title says, I'm trying to deploy a Lambda@Edge, and I'm getting the following error:
ServerlessError: Lambda@Edge cannot enable replication for the specified Lambda function.
Update the IAM policy to add permission: lambda:EnableReplication* for
resource: arn:aws:lambda:us-east-1:xxxxxxxxxx:function:XXXZZZZYYYYY:2 and try again.
There's little documentation about this error in internet, but the little I've found pointed to add a permission to the lambda function:
EdgeAuthEnableReplicationPermission:
Type: 'AWS::Lambda::Permission'
Properties:
Action: "lambda:EnableReplication"
FunctionName: "XXXZZZZYYYYY"
Principal: "*"
This is my serverless.yml file:
service: lambda-test
useDotenv: true
provider:
name: aws
region: 'us-east-1'
stage: 'sbx'
versionFunctions: true
plugins:
- serverless-lambda-edge-pre-existing-cloudfront
functions:
countryResolver:
name: 'XXXZZZZYYYYY'
handler: src/index.js
events:
- preExistingCloudFront:
distributionId: 'zzzzzzzz'
eventType: 'origin-request'
pathPattern: '*'
includeBody: false
stage: sbx
resources:
Resources:
IamRoleLambdaExecution:
Type: "AWS::IAM::Role"
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
- edgelambda.amazonaws.com
Action: sts:AssumeRole
EdgeAuthEnableReplicationPermission:
Type: 'AWS::Lambda::Permission'
Properties:
Action: "lambda:EnableReplication"
FunctionName: "XXXZZZZYYYYY"
Principal: "*"
Metadata
Metadata
Assignees
Labels
No labels