In this article, we’re going to learn how we can use DynamoDB in the NestJS application using the Serverless framework on the AWS platform.

Image for post
Image for post
DynamoDB in NestJS application with Serverless framework on AWS

Before we proceed, first we need to set up a NestJS application into the Serverless framework.

Once done the setup of the NestJS application in the Serverless framework, we can proceed with our hands-on steps.

Hands-on Steps:

Install node dependencies:

This node package that we need to install first before we proceed.

npm install --save aws-sdk

Update configuration file:

Here we need to add all these additional configurations of DynamoDB and its permission for the Serverless


In this article, we’re going to learn how we can run a NestJS application as a Lamda function using the Serverless framework on the AWS platform.

Image for post
Image for post
NestJS application in Serverless framework on AWS

Hands-on Steps:

Create NestJS application:

First, we need to install Nest CLI globally to create a NestJS application.

npm i -g @nestjs/clinest new nest-sls && cd nest-sls

Install node dependencies for Serverless:

These are the node packages that we need to install first before we proceed.

npm install aws-lambda aws-serverless-express express --save

Map NestJS with ExpressJS:

Here we map our NestJS application into the ExpressJS application so that we can use this during AWS Lamda function implementation.

// src/app.tsimport { NestFactory } from '@nestjs/core'; import {…


In the terminal, execute the command below:

zip -r -s 512 archive.zip FolderName/

Note that the default unit is in m(MB). As per needed, can use k(KB), g(GB), or t(TB).

For unarchiving, may need to use any third-party tools such as Unarchiver.

Muhd Mohaiminul Islam

Senior Engineer, Full Stack @ Carsome Sdn Bhd

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store