Serverless framework is an awesome tool for AWS lambda. For a new project, if you have seen this warning when deploying:
Warned - no cfnRole set:
Require the cfnRole option, which specifies a particular role for CloudFormation to assume while deploying.
It is a typical permission problem, let’s see how to solve it.
- IAM -> Access management -> Roles
Create Role button
Select type of trusted entity: AWS Service
Choose a use case:
Next:Permission button at bottom.
Select the permissions that you need:
For me they are:
The permissions with
* are must-have. Actually, you can fully tweak the
IAMFullAccess, but it lacks information.
Then you can
next to the end.
- Click the role you just created, then click
Edit trust relationshipbutton.
- You can see a json there, add
Statement.Principal.Service, make it an array if it is not.
The result looks like this:
That’s all, hope it helps.
Thanks for reading!
Follow me (albertgao) on twitter, if you want to hear more about my interesting ideas.