Originally published on ajeetchaulagain.com on March 30, 2026.
Deploying a NestJS application to AWS Lambda behind API Gateway sounds straightforward — until you start wiring things together.
Between adapting NestJS to a serverless runtime, configuring API Gateway , and setting up infrastructure with AWS CDK , there are several moving parts that can quickly become messy. While working on a personal side project, I ran into these challenges firsthand — particularly around adapting NestJS to Lambda's execution model.
By the end of this guide, you'll have:
A NestJS app adapted for Lambda's execution model using @codegenie/serverless-express
Infrastructure defined as code: a Lambda function and HTTP API Gateway, provisioned with AWS CDK
A GitHub Actions workflow that builds and deploys your stack automatically on every push to main
The complete source code is available on GitHub .
Prerequisites
To follow along, you'll need:
An AWS account
Basic familiarity with Node.js and NestJS
Basic familiarity…