连接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 個月前檢視次數 63 次
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 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南