Solve - (Lambda) The provided execution Role does not have Permissions

avatar

Borislav Hadzhiev

Wed Sep 29 20212 min read

banner

Photo by Trung Thanh

Solve - The provided execution Role does not have Permissions #

To solve the lambda error - "The provided execution role does not have permissions to call DescribeNetworkInterfaces" we have to attach the AWSLambdaVPCAccessExecutionRole managed policy to the function's execution role.

The error occurs, because lambda functions in a VPC need to have permissions to create and manage elastic network interfaces.

To attach the AWSLambdaVPCAccessExecutionRole policy to the function, you have to:

  1. Open the AWS Lambda console and click on the function's name
  2. Click on the Configuration Tab and then click Permissions

click on role

  1. Click on the function's role and then click on Attach policies
  2. Filter for the AWSLambdaVPCAccessExecutionRole managed policy, click the checkbox next to its name and click Attach Policy

attach vpc access policy

The AWSLambdaVPCAccessExecutionRole grants the lambda function permissions to create and manage elastic network interfaces and log to CloudWatch.

AWSLambdaVPCAccessExecutionRole
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents", "ec2:CreateNetworkInterface", "ec2:DescribeNetworkInterfaces", "ec2:DeleteNetworkInterface", "ec2:AssignPrivateIpAddresses", "ec2:UnassignPrivateIpAddresses" ], "Resource": "*" } ] }

After the function has permissions to create and manage elastic network interfaces the "The provided execution role does not have permissions to call DescribeNetworkInterfaces" should be resolved.

If you still getting the error message, make a small change to the lambda function, e.g. increase its timeout by 1 second or add an extra print statement in the function's code and click on the Deploy button.

Further Reading #

Join my newsletter

I'll send you 1 email a week with links to all of the articles I've written that week

Buy Me A Coffee