AWS Lambda function error: You are not authorized to perform: CreateNetworkInterface

You are not authorized to perform: CreateNetworkInterface.

Here the error message itself saying that the Lambda function is not authorized to perform: CreateNetworkInterface". So we need to create appropriate policy and attach it to the Lambda function.

The below given policy will help to resolve this error.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Resource": "*",
            "Action": [
                "ec2:DescribeInstances",
                "ec2:CreateNetworkInterface",
                "ec2:AttachNetworkInterface",
                "ec2:DescribeNetworkInterfaces",
                "ec2:DeleteNetworkInterface",
                "autoscaling:CompleteLifecycleAction"
            ]
        }
        ]
}

We need to create this policy and attach to the role which the Lambda is using.

That's all…

Leave a Reply

Your email address will not be published. Required fields are marked *