CLI AWS Version:
aws --version aws-cli/1.11.21 Python/2.7.12 Darwin/15.3.0 botocore/1.4.78
Trying to create a Lambda function and get an error:
An error occurred (InvalidParameterValueException) when calling the CreateFunction operation: The role defined for the function cannot be assumed by Lambda.
The role was created as:
aws iam create-role
trust.json :
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "lambda.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }
Policy has been added as:
aws iam put-role-policy --policy-document file:
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:*:*:*" } ] }
A few minutes were expected, as mentioned in [1] and [2] , but still the error does not go away. The policy and trust associated with the role are similar to the default role created when the Lambda function was created using the console.
Full steps are listed at https://github.com/arun-gupta/serverless/tree/master/aws/microservice .
What is missing?