I spent some time awhile ago to play with and learn Serverless Framework, it has been super helpful in the process of creating back end APIs – I almost can’t imagine writing lambda functions without it!
This short post will explain what Serverless Framework is, how it can be used, why it is great and how you can learn to use it!
Table of Contents
What is Serverless Framework
Serverless (SLS) Framework is a Infrastructure as Code (IaC) framework, that focusses on defining serverless resources through the use of yaml and json files.
How it works
What separates SLS Framework from other IaC frameworks like Terraform, is that it is focusses on back end developers, rather than devops engineers.
When you write a SLS Framework configuration file, it is super quick to configure orchestration lambdas that you want to deploy to an API Gateway.
This allows Back End Developers to focus writing the actual business logic of the back end apis rather than the configuration of the infrastructure.
It is possible for SLS Framework to be used to also configure the cloud infrastructure too if needed, as it is built on top each cloud providers’ IaC framework (for AWS this is CloudFormation, for Azure it is Azure Resource Manager and for GCP it is Cloud Deployment Manager).
Why should you learn serverless framework
Serverless Framework provides developers who don’t traditionally focus on devops with an opportunity – to gain experience in developing their devops skills and bridge the gap between developers and more ‘ops’ focussed devops engineers.
Even if a developer is not interested in developing their devops capability, Serverless Framework is great to use regardless, as it allows developers to document their backend api endpoints and lambda functions in a git repo – making it easier to keep track of backend logic.
A big selling point for Serverless Framework, is that it is super easy to spin up a local development environment to test your back end logic. This means you don’t have to constantly redeploy your serverless framework code in development, you can just work iteratively locally (e.g on localhost:4000) and every time you save it will refresh your local development server.
Lastly, Serverless Framework is super flexible on what languages you can use to write you backend logic!! That means it doesn’t matter if you like to write your lambda functions in python, nodejs, rust, go – nothing can hold you back 😀
Where to start
GO BEYOND – Useful links to explore!
- Set up a local host development environment
- Spin up and get data from dynamodb
- Set up a cognito login in user pool, set up a JWT authorizer on your endpoints and set up custom user attributes
- Set up websocket api (official documentation), another generally useful websocket tutorial and another websocket tutorial with an authorizer,
- Configure your API’s CORS policy
Serverless Framework is a great tool to use by itself, it is however made even more powerful when combined with other technologies as part of a greater devops process!
I hope this post helps you understand how best to learn Serverless Framework, have fun creating your APIs 😀