gpt4 book ai didi

aws-lambda - 提供的执行角色没有调用 EC2 上的DescribeNetworkInterfaces 的权限

转载 作者:行者123 更新时间:2023-12-04 08:02:46 26 4
gpt4 key购买 nike

当我在此函数中输入任何代码(例如 console.log();)并单击“保存”时,会发生错误:

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

exports.handler = (event, context, callback) => {
callback(null, 'Hello from Lambda');
console.log(); // here is my code
};

我将函数与角色绑定(bind):lambda_excute_execution(Policy:AmazonElasticTranscoderFullAccess)

并且该函数现在没有与任何触发器绑定(bind)。

然后,我赋予角色AdministratorAccess策略,我可以正确保存我的源代码。

该角色在今天之前可以成功运行函数。

有人知道这个错误吗?

最佳答案

如果您尝试在 VPC 中部署 Lambda,但未为其提供所需的网络接口(interface)相关权限 ec2:DescribeNetworkInterfacesec2:CreateNetworkInterfaceec2:DeleteNetworkInterface(请参阅 AWS Forum )。

例如,这是一个允许将 Lambda 部署到 VPC 中的策略:

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

关于aws-lambda - 提供的执行角色没有调用 EC2 上的DescribeNetworkInterfaces 的权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41177965/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com