cannot create aws lamda function due to some cryptic error message

Aws Lambda

Aws Lambda Problem Overview


I am trying to create an aws lambda function but when I click 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

I have absolutely no idea what this means.

Aws Lambda Solutions


Solution 1 - Aws Lambda

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

Solution 2 - Aws Lambda

This video https://www.youtube.com/watch?v=BZzEXVkVOM8 explains the issue.

Issue: 5:39 enter image description here

And the resolution 6:33 enter image description here

Solution 3 - Aws Lambda

  1. Just go to your lambda function, Click the configuration tab -> then the permission tab (from the left menu) -> Click on your role name
  2. Then it will navigate to the relevant IAM role page.
  3. Click Trust Relationships Tab
  4. Click on the Edit policy button and add the content that @Mark mentioned.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questiondagda1View Question on Stackoverflow
Solution 1 - Aws LambdaMark BView Answer on Stackoverflow
Solution 2 - Aws LambdaAlanView Answer on Stackoverflow
Solution 3 - Aws LambdaElshanView Answer on Stackoverflow