The provided execution Role does not have Permissions [Fix]

Borislav Hadzhiev

2 min


# The provided execution Role does not have Permissions

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

The error occurs because lambda functions in a VPC need to have permission 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 Add permissions and 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.

{ "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 permission to create and manage elastic network interfaces, the error will be resolved.

If the error persists, 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.

I've also written a tutorial on how to add permissions to Lambda functions in AWS CDK.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.