Lambda无法承担为该功能定义的角色 [英] The role defined for the function cannot be assumed by Lambda
问题描述
当我尝试使用create-function命令创建lambda函数时,收到错误消息"Lambda无法承担为该函数定义的角色".
I'm getting the error "The role defined for the function cannot be assumed by Lambda" when I'm trying to create a lambda function with create-function command.
aws lambda创建功能
--region us-west-2
--function-name HelloPython
--zip文件fileb://hello_python.zip
--role arn:aws:iam :: my-acc-account-id:role/default
--handler hello_python.my_handler
--runtime python2.7
--timeout 15
-内存大小512
aws lambda create-function
--region us-west-2
--function-name HelloPython
--zip-file fileb://hello_python.zip
--role arn:aws:iam::my-acc-account-id:role/default
--handler hello_python.my_handler
--runtime python2.7
--timeout 15
--memory-size 512
推荐答案
我收到错误消息"Lambda无法承担为该功能定义的角色",因为我尚未更新角色信任关系"配置文件.我没有遇到评论链接答案中的超时问题.
I got the error "The role defined for the function cannot be assumed by Lambda" because i had not updated the roles "Trust Relationship" config file. I didn't encounter the timeout issues as in the linked answer in the comments.
以上答案中的注释指出您需要添加以下内容.
- 转到"IAM>角色> YourRoleName"
- (注意:如果未列出您的角色,则需要创建它.)
- Go to 'IAM > Roles > YourRoleName'
- (Note: if your role isn't listed, then you need to create it.)
我的结局如下.
{
"Version": "2012-10-17",
"Statement": [
{
<your other rules>
},
{
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
这篇关于Lambda无法承担为该功能定义的角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!