Learn Serverless Framework
Tags: serverless, aws, node, devops
Published: 2021-12-20 19:30:58

---
title: Learn Serverless Framework
published: true
date: 2021-10-31 11:08:55 UTC
tags: serverless,aws,node,devops
canonical_url: https://jamesmiller.blog/why-you-should-learn-serverless-framework/
cover_image: https://i2.wp.com/jamesmiller.blog/wp-content/uploads/2021/10/slsframework.jpg
---

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!

### 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.

### <meta charset="utf-8">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 ![😀](https://s.w.org/images/core/emoji/13.1.0/72x72/1f600.png)

### Where to start

1. [Install Serverless Framework on your computer](https://www.serverless.com/framework/docs/getting-started)
2. [Set up AWS access with IAM](https://www.serverless.com/framework/docs/providers/aws/guide/credentials/)
3. [Deploy your first lambda](https://www.serverless.com/framework/docs/providers/aws/guide/quick-start)

### GO BEYOND – Useful links to explore!

- [Set up a local host development environment](https://www.serverless.com/plugins/serverless-offline)
- [Spin up and get data from dynamodb](https://faun.pub/getting-started-with-serverless-framework-637e67381210)
- [Set up a cognito login in user pool, set up a JWT authorizer on your endpoints](https://forum.serverless.com/t/how-to-access-cognito-user-pool-arn-as-a-function-authorizer/9630/5) and [set up custom user attributes](https://stackoverflow.com/questions/59388115/deploy-aws-userpool-via-cloudformation-with-attribute-update)
- [Set up websocket api (official documentation)](https://github.com/serverless/serverless-websockets-plugin/tree/master/example), [another generally useful websocket tutorial](https://blog.neverendingqs.com/2019/07/01/serverless-websocket-example.html) and [another websocket tutorial with an authorizer](https://codeburst.io/how-to-build-a-react-chat-app-with-aws-api-gateway-websockets-and-cognito-custom-authorizer-6f84f2da47ec), 
- [Configure your API’s CORS policy](https://www.serverless.com/blog/cors-api-gateway-survival-guide)

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](https://jamesmiller.blog/combine-terraform-and-serverless-framework/)!

I hope this post helps you understand how best to learn Serverless Framework, have fun creating your APIs ![😀](https://s.w.org/images/core/emoji/13.1.0/72x72/1f600.png)