Search code examples
amazon-web-servicesaws-lambdaaws-lambda-edge

Why do I get 'execution role must be assumable' error when trying to deploy to Lambda@Edge?


I am trying to deploy to Lambda@Edge within AWS, but when I click on 'Deploy' I get this error message:

Correct the errors below and try again.

Your function's execution role must be assumable by the edgelambda.amazonaws.com service principal.

enter image description here


Solution

  • From the Lambda@Edge IAM Role documentation:

    You must create an IAM role that can be assumed by the service principals lambda.amazonaws.com and edgelambda.amazonaws.com. This role is assumed by the service principals when they execute your function. For more information, see Creating the Roles and Attaching the Policies (Console) in the topic "AWS Managed Policies for Job Functions" in the IAM User Guide.

    You add this role under the Trust Relationship tab in IAM (do not add it under the Permissions tab).

    Here's an example role trust policy:

    {
       "Version": "2012-10-17",
       "Statement": [
          {
             "Effect": "Allow",
             "Principal": {
                "Service": [
                   "lambda.amazonaws.com",
                   "edgelambda.amazonaws.com"
                ]
             },
             "Action": "sts:AssumeRole"
          }
       ]
    }
    

    Note : If you're doing this via the AWS Console then you have to refresh the browser after you update your IAM Role Credits: from comments @AJB