एडब्ल्यूएस CLI संस्करण:एडब्ल्यूएस CLI: भूमिका समारोह के लिए परिभाषित लैम्ब्डा द्वारा नहीं माना जा सकता
aws --version
aws-cli/1.11.21 Python/2.7.12 Darwin/15.3.0 botocore/1.4.78
एक लैम्ब्डा समारोह बनाने के लिए कोशिश कर रहा है और त्रुटि हो रही है:
An error occurred (InvalidParameterValueException) when calling the CreateFunction operation: The role defined for the function cannot be assumed by Lambda.
भूमिका के रूप में बनाया गया था :
aws iam create-role --role-name microrole --assume-role-policy-document file://./trust.json
trust.json
है:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
नीति जुड़ा था के रूप में:
aws iam put-role-policy --policy-document file://./policy.json --role-name microrole --policy-name micropolicy
policy.json
है:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "arn:aws:logs:*:*:*"
},
{
"Effect": "Allow",
"Action": [
"apigateway:*"
],
"Resource": "arn:aws:apigateway:*::/*"
},
{
"Effect": "Allow",
"Action": [
"execute-api:Invoke"
],
"Resource": "arn:aws:execute-api:*:*:*"
}
]
}
कई मिनट के रूप में [1] और [2] में उल्लेख किया है, लेकिन अभी भी त्रुटि दूर नहीं जा रहा है के लिए इंतज़ार किया। भूमिका से जुड़ी नीति और ट्रस्ट कंसोल का उपयोग करते हुए लैम्ब्डा फ़ंक्शन बनाया गया है जब बनाई गई डिफ़ॉल्ट भूमिका के समान है।
पूर्ण चरण https://github.com/arun-gupta/serverless/tree/master/aws/microservice पर सूचीबद्ध हैं।
क्या गुम है?