Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot create aws lamda function due to some cryptic error message

Tags:

aws-lambda

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.

like image 827
dagda1 Avatar asked Dec 15 '18 18:12

dagda1


People also ask

How do I troubleshoot Lambda function failures?

To troubleshoot Lambda code errors You can use CloudWatch to view all logs generated by your function's code and identify potential issues. For more information, see Accessing Amazon CloudWatch Logs for AWS Lambda.

What happens when a Lambda function fails?

Asynchronous invocation – Lambda retries function errors twice. If the function doesn't have enough capacity to handle all incoming requests, events might wait in the queue for hours or days to be sent to the function.

What is Lambda invocation error?

Invocation errors can be caused by issues with request parameters, event structure, function settings, user permissions, resource permissions, or limits. If you invoke your function directly, you see any invocation errors in the response from Lambda.


2 Answers

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

like image 117
Mark B Avatar answered Sep 28 '22 03:09

Mark B


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

like image 30
Alan Avatar answered Sep 28 '22 03:09

Alan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!