AWS CLI: The role defined for the function cannot be assumed by Lambda

Question:

AWS CLI version:

Trying to create a Lambda function and getting the error:

Role was created as:

trust.json is:

Policy was attached as:

policy.json is:

Waited for multiple minutes as mentioned at [1] and [2] but still the error is not going away. The policy and trust attached to the role is similar to the default role created when Lambda Function is created using Console.

Complete steps are listed at https://github.com/arun-gupta/serverless/tree/master/aws/microservice.

What’s missing?

Answer:

The Lambda function was created as:

The correct command is:

The difference is that the role was incorrectly specified as role/service-role/microRole instead of role/microRole.

Leave a Reply