...

/

Create First Serverless Stack

Create First Serverless Stack

Create a Serverless Framework project from scratch.

We'll cover the following...

Previously, we learned the anatomy of a template of the serverless.yml file of the Serverless Framework and its basic commands. We also managed to generate a dummy project from the available templates. In this lesson, we'll work on generating what we want ourselves, and we'll learn in practice how to do it. We'll create a simple project using the Serverless Framework. In that project, we'll create a Lambda function in TS and then link this to the API Gateway so that our Lambda can be called an API.

Below, we can see the project, opened on the serverless.yml file; please click “Run.” This will prepare the environment for us to work in.

service: my-first-serverless-project

provider:
  name: aws
  runtime: nodejs18.x
  stage: dev
  region: us-east-1

plugins:
  - serverless-esbuild
Serverless project with terminal

This serverless.yml template file serves as a starting point for our first serverless project. To define and deploy functions, we'll need to add a functions section and specify the necessary configurations for each function. We can also include other provider-specific settings, such as IAM roles, custom resources, and environment variables, depending on what we need.

Let's break down the current template components:

  • service: ...