Learn 30 serverless best-practices with sls-mentor

pchol22

Pierre Chollet

Posted on July 12, 2023

Learn 30 serverless best-practices with sls-mentor

Your serverless app is not perfect (yet)

Are you currently learning serverless, or are you already an expert? Whatever... AWS offers so many services and possible configurations that it is hard to keep track of all the best practices.

With my team, we've been building serverless apps on AWS for several years now. We've learned a lot, and it seemed natural to us to share our knowledge with the community, with you!

Introducing sls-mentor, a free and open-source tool that automatically analyzes your AWS Serverless application and gives you tips to improve it!

sls-mentor will rate your application against 30 best practices, and then assign you a score in each of the following categories:

  • šŸŒ³ Green IT šŸŒ³
  • šŸ›” Security šŸ›”
  • šŸš€ Speed šŸš€
  • šŸ’° IT Costs šŸ’°
  • šŸ’Ŗ Stability šŸ’Ŗ

Find us on Github ā­ļø

ā¬‡ļø I post serverless content very regularly, if you want more ā¬‡ļø

Follow me on twitter šŸš€

How does sls-mentor work?

Nothing simpler! With your AWS credentials loaded in your CLI, run the following command:

npx sls-mentor@latest --report
Enter fullscreen mode Exit fullscreen mode

If you encounter errors when running the command, try specifying a profile with -p and a region with -r

That's all!

ā„¹ļø We require credentials with AdminReadOnly permissions. sls-mentor basically executes a bunch of list and describe API calls against your resources

The sls-mentor analysis

sls-mentor will then analyze your app directly from the cloud, and produce a super nice report like this one:

sls-mentor report

The report will be generated in your current directory, in a file called .sls-mentor/index.html

Your app is assessed against 5 categories, and we give you 3 tips to quickly improve your score! For each tip, we give you an explanation of the problem, and a way to fix it.

Behind the scenes, sls-mentor is running a set of 30 rules that we've written. Want more details about what went wrong? The CLI will give you for each resource the list of rules that failed, and the reason why.

sls-mentor CLI

ā„¹ļø If you don't want a report, but just want to see the list of rules that failed, just remove the --report flag.

What next? We need your help!

  • Our reporting feature is quite new, we want to improve it! Things like service-wide stats, better recommendations are on our roadmap.
  • sls-mentor lacks security rules related to IAM policies for example. We will add them soon!
  • AWS is not only about serverless, if you have some serverful knowledge to share with us, feel free to contribute!
  • We've got existing issues waiting for contributors, and we are open to new ideas too! Feel free to join us on GitHub!

Learn more about sls-mentor

See our website for more information, or check out our GitHub repository!

With the team, we already produced some articles featuring sls-mentor rules in depth. Feel free to check them out!

A big thanks to everyone I am working with on this project, especially Juliette, Marek, Quentin and Vincent!

Find us on Github ā­ļø

šŸ’– šŸ’Ŗ šŸ™… šŸš©
pchol22
Pierre Chollet

Posted on July 12, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related