连接Lambda VPC与DocumentDb时出现错误信息:The provided execution role does not have permissions to call CreateNetworkInterface on EC2

0

【以下的问题经过翻译处理】 我想在我的Lambda函数中访问DocumentDb。我尝试在Lambda函数的“编辑VPC”页面中配置我的VPC,但是我收到了这个错误信息,阻止了我的操作:

The provided execution role does not have permissions to call CreateNetworkInterface on EC2 我该怎么解决这个问题呢?

profile picture
专家
已提问 5 个月前59 查看次数
1 回答
0

【以下的回答经过翻译处理】 你好,

Lambda函数执行角色必须具有创建、描述和删除ENI的权限。 AWS Lambda提供了一个权限策略,即AWSLambdaVPCAccessExecutionRole,其中包含所需的EC2操作(ec2:CreateNetworkInterface,ec2:DescribeNetworkInterfaces和ec2:DeleteNetworkInterface)的权限,您可以在创建角色时使用。

只需将这些权限添加到Lambda IAM角色策略中,如下所示:

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

参见:https://repost.aws/knowledge-center/lambda-permissions-issues

希望对您有所帮助,如果有,我会感激您接受答案,这样社区在搜索类似问题时可以受益,谢谢;)

profile picture
专家
已回答 5 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则