AWS Lambda:The provided execution role does not have permissions to call DescribeNetworkInterfaces on EC2

前端 未结 6 1519
难免孤独
难免孤独 2021-02-06 21:17

Today I have a new AWS Lambda question, and can\'t find anywhere in Google.

I new a Lambda function, there is no question. But when I input any code in this function[eg.

6条回答
  •  灰色年华
    2021-02-06 21:53

    This error is common if you try to deploy a Lambda in a VPC without giving it the required network interface related permissions ec2:DescribeNetworkInterfaces, ec2:CreateNetworkInterface, and ec2:DeleteNetworkInterface (see AWS Forum).

    For example, this a policy that allows to deploy a Lambda into a VPC:

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

提交回复
热议问题