---
title: Setting Up a NodeJs/TypeScript CI/CD Pipeline for AWS Lambda Using GitHub Action and Serverless
description: Learn Setting Up a NodeJs/TypeScript CI/CD Pipeline for AWS Lambda Using GitHub Action and Serverless framework.
image: https://www.craftsmensoftware.com/hubfs/Setting-Up-a-NodeJsTypeScript-CICD-Pipeline-for-AWS-Lambda-Using-GitHub-Action-and-Serverless.webp
---

[Skip to main content](https://www.craftsmensoftware.com/blog/setting-up-a-nodejs/typescript-ci/cd-pipeline-for-aws-lambda-using-github-action-and-serverless#main-content)

[![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png) ![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png) ![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png) ![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png)](https://www.craftsmensoftware.com)

- [About us](https://www.craftsmensoftware.com/about-us)
- [Client Stories](https://www.craftsmensoftware.com/client-success-stories)
- [How We Work](https://www.craftsmensoftware.com/how-we-work)
- [Case Study](https://www.craftsmensoftware.com/case-study)
- [Blog](https://www.craftsmensoftware.com/blog)
- [Career](https://careers.craftsmensoftware.com/)

Open main navigation

Close main navigation

- [About us](https://www.craftsmensoftware.com/about-us)
- [Client Stories](https://www.craftsmensoftware.com/client-success-stories)
- [How We Work](https://www.craftsmensoftware.com/how-we-work)
- [Case Study](https://www.craftsmensoftware.com/case-study)
- [Blog](https://www.craftsmensoftware.com/blog)
- [Career](https://careers.craftsmensoftware.com/)
- [Get In Touch](https://www.craftsmensoftware.com/contact-us)

[Get In Touch](https://www.craftsmensoftware.com/contact-us)

## Setting Up a NodeJs/TypeScript CI/CD Pipeline for AWS Lambda Using GitHub Action and Serverless

![Setting Up a NodeJs/TypeScript CI/CD Pipeline for AWS Lambda Using GitHub Action and Serverless](https://www.craftsmensoftware.com/hs-fs/hubfs/Setting-Up-a-NodeJsTypeScript-CICD-Pipeline-for-AWS-Lambda-Using-GitHub-Action-and-Serverless.webp?width=1200&height=820&name=Setting-Up-a-NodeJsTypeScript-CICD-Pipeline-for-AWS-Lambda-Using-GitHub-Action-and-Serverless.webp)

## Introduction

When working with an [AWS Lambda](https://aws.amazon.com/lambda/) project, it’s common to change your code locally, and then upload it on AWS daily or at least a weekly basis. It’s very much true for projects that are medium or large and where new features and bugfixes are constantly being added. A CI/CD pipeline can help a lot in these cases, as the developers don’t have to push the code on AWS manually and don’t have to worry about stuff related to pushing. They can just do their work and forget about the unnecessary things. And it’s also very easy to create such a pipeline just using [GitHub Actions](https://github.com/features/actions) and [Serverless Framework](https://www.serverless.com/).

Today we are going to create a pipeline to automate the deploy of a NodeJs project using GitHub Action and Serverless. I’m going to use Node as the runtime of the AWS Lambda and will be using [TypeScript](https://www.typescriptlang.org/) to write the lambda.

## Source Code

You can get all the codes used in this project in this [**GitHub Repository**](https://github.com/AsifShaafi/aws_lambda_github_pipeline). If you want, you can skip the post and get the codes and play around with them however you like.

## Requirements

Before getting started with the post, you must have some knowledge on [Serverless Framework](https://www.serverless.com/) which is used for deploying AWS Lambda functions. It also helps to configure the AWS services so that we don’t have to do them manually from the AWS console.

![112](https://www.craftsmensoftware.com/hs-fs/hubfs/112.webp?width=300&height=157&name=112.webp)

But if you aren’t familiar with it and want to get started, then you follow this [quick-start guide for the Serverless Framework](https://serverless.com/framework/docs/providers/aws/guide/quick-start/).

Before following this tutorial, make sure you have Serverless Framework installed and configured on your working environment. Also, you need to have a working [GitHub](https://github.com/) account. If you don’t have any then create a GitHub account from [here](https://github.com/join).

Now let’s get going with the tutorial…

## Create AWS Lambda project with Serverless

First, we need to create a TypeScript based AWS Lambda project using the Serverless Framework CLI. Open up any terminal and enter the following command:

serverless create --template aws-nodejs-typescript --path \<your-folder-name\>

 Copy

 

> Here, the *–template* flag will generate some files for the given template. You can get more templates from [here](https://www.serverless.com/framework/docs/providers/aws/cli-reference/create#available-templates). For more info on *serverless create* command, check [here](https://www.serverless.com/framework/docs/providers/aws/cli-reference/create/).

The above command will create a new directory with the name you gave in `<your-folder-name>` and create some new files like *handler.ts, serverless.ts, package.json, tsconfig.json, webpack.config.js*. The *handler.ts*file contains some boiler code:

And the *serverless.ts* file contains the configuration for deploying the function on AWS. If want to know what can be configured with the file, take a look [here](https://serverless.com/framework/docs/providers/aws/guide/serverless.yml/).

Now go to the directory that was created and open cmd pointing the directory and run the following command:

npm install

 Copy

 

This will install all necessary npm libraries.

## Create Serverless Deploy Script

In the project directory, we need to configure the *package.json* file a bit to be able to deploy the lambda project on AWS Lambda directly using the *npm* script command. Here is the code after adding the *npm* script:

Note: Please make sure that the [***serverless*** npm library](https://www.npmjs.com/package/serverless) is present in the *package.json*file. If not then you can add it using this command:

npm i serverless -D

 Copy

 

Now it’s time to deploy the code!!

## Test Deploy Manually

To test that the *npm* script is working as well as the main code, let’s deploy the lambda project manually. For that, go to the root directory, open any terminal, and execute:

```
npm run-script deploy
```

If everything is working as expected, then you will see this message on your terminal:

 ![55](https://www.craftsmensoftware.com/hs-fs/hubfs/55.webp?width=300&height=248&name=55.webp)

Serverless deploy response

And if you go to the address given in the *endpoints* section, we will see this:

![56](https://www.craftsmensoftware.com/hs-fs/hubfs/56.webp?width=300&height=37&name=56.webp)

If all of these went well, then we are good to create the GitHub Action and create the pipeline.

## Create GitHub Action

For making GitHub Action work, we have to put the workflow file into a specific folder in the desired project directory. We will create the folders and the workflow/action file using some simple steps:

1. In the root directory of the project, create a **folder** named ***.github***
2. Go the the ***.github*** folder and create another **folder** named ***workflows***
3. Go to the newly created folder and create a new **file** named *aws\_lambda\_deploy.yaml*and copy-paste the following code snippet:

This code will be triggered when the action workflow when you ***push*** any code on the ***master*** branch on GitHub. You can learn more options for the trigger from [here](https://docs.github.com/en/actions/reference/events-that-trigger-workflows).

## Add AWS Secrets

To make the workflow work as intended, we need to add the AWS User *access key* and *secret access key* and set them in`AWS_ACCESS_KEY_ID`and `AWS_SECRET_ACCESS_KEY` respectively. We will set this up now.

## Get the User Secrets from AWS Console

For getting the access key and secret access key, go to [IAM](https://console.aws.amazon.com/iam/home) service in the [AWS Management Console](https://console.aws.amazon.com/console/home). If you are not sure how to get them or need to create a new role, check [**this article**](https://serverless-stack.com/chapters/create-an-iam-user.html).

## Set the User Secrets in GitHub

To set the user secrets, use the following steps:

1. Open your GitHub repository on any browser, then click on the *“Settings”* tab.
   
   ![11](https://www.craftsmensoftware.com/hs-fs/hubfs/11.webp?width=300&height=133&name=11.webp)
   
   Select the “Settings” tab
2. Then on the left navigation panel, select “Secrets”.
   
   ![12](https://www.craftsmensoftware.com/hs-fs/hubfs/12.webp?width=300&height=110&name=12.webp)
3. In the “Secrets” page, press the *“New Secret”* button on the top right corner.
   
   ![13](https://www.craftsmensoftware.com/hs-fs/hubfs/13.webp?width=300&height=128&name=13.webp)
4. On the new page, put `AWS_ACCESS_KEY_ID` in the *“Name”* filed and put the *access key* value from the AWS IAM. 
   
   ![14](https://www.craftsmensoftware.com/hs-fs/hubfs/14.webp?width=300&height=115&name=14.webp)
5. Repeat the 3rd step for adding `AWS_SECRET_ACCESS_KEY` secret.

 

## Sit Back and Enjoy!

And we are done! If you have made this far, that means you have successfully created a pipeline to deploy your AWS Lambda project on AWS! Now it’s time to see it in action. Make some changes in your *handler.ts*file and push it on the ***master*** branch. I made the following change:

 

 

 

 

 

 

## import "source-map-support/register"; import { APIGatewayProxyHandler } from "aws-lambda"; export const hello: APIGatewayProxyHandler = async (event, \_context) =\> { return { statusCode: 200, body: JSON.stringify( { message: "This code is deployed directly from the CI/CD pipeline using GitHub Action and Serverless!", httpMethod: event.httpMethod, }, null, 2 ), }; };

 Copy

   
 After you push the code, you can track the pipeline by going to the *“Actions”* tab on the GitHub repository and selecting the latest workflow. If you see a green checkmark (✔️) beside the workflow, that means the workflow was successfully executed and you have deployed your code without doing any extra steps! 

![15](https://www.craftsmensoftware.com/hs-fs/hubfs/15.webp?width=300&height=81&name=15.webp)

You can also verify that by going to the URL you got before when we deployed the code manually. Here is mine: 

![16](https://www.craftsmensoftware.com/hs-fs/hubfs/16.webp?width=300&height=59&name=16.webp)

This is all you need to create a basic CI/CD pipeline to deploy on AWS Lambda. You can also add code unit testing, lint checking, and various other things by modifying the GitHub Action workflow according to your needs, but this post is just to get you started.

Hope this will help you with your developer journey. Happy coding! 😃

![Asif Imtiaj Safi](https://www.craftsmensoftware.com/hs-fs/hubfs/asif%20imtiaz%20safi.png?width=120&height=120&name=asif%20imtiaz%20safi.png)

Author: **[Asif Imtiaj Safi](https://www.craftsmensoftware.com/blog/author/asif-imtiaj-safi)**  
 06/04/2024

 Software Development Engineer

![Hire AI-Native Engineers](https://www.craftsmensoftware.com/hubfs/Z63_3132.webp)

## Hire AI-Native Engineers

[![Book A Strategy Call](https://www.craftsmensoftware.com/hubfs/Book%20A%20Strategy%20Call.svg)](https://www.craftsmensoftware.com/contact-us)

### **About Craftsmen**

[The Team](https://www.craftsmensoftware.com/about-us)

[Our Partnership Model](https://www.craftsmensoftware.com/how-we-work)  
[Career](https://careers.craftsmensoftware.com/)

[FAQ](https://www.craftsmensoftware.com/frequently-asked-questions-faq)  
[Privacy Policy](https://www.craftsmensoftware.com/privacy-policy-best-software-development-company-in-bangladesh) 

[Craftsmen LinkedIn Page](https://linkedin.com/company/craftsmensoftware)   [Craftsmen Facebook Page](https://www.facebook.com/craftsmenltd/)   [Craftsmen Youtube Page](https://www.youtube.com/@craftsmensoftware)

### **Headquarter**

**Craftsmen UK**  
One Sovereign Quay, Bridge End, Leeds, West Yorkshire LS1 4AG United Kingdom 

**Operational Hub

Craftsmen Bangladesh**  
Plot # 316, Lane # 4, DOHS Baridhara,

Dhaka - 1206, Bangladesh

### **Sales & Partnership Offices**

**Craftsmen Norway**  
Kong Oscars gate 66, 68, 5017 Bergen, Norway

**Craftsmen France**  
6 Avenue Pierre Grenier, 92100 Boulogne-Billancourt, Paris, France

### **A Team You Can Trust**

#### [![ISO Certificates New](https://www.craftsmensoftware.com/hs-fs/hubfs/ISO%20Certificates%20New.png?width=300&height=96&name=ISO%20Certificates%20New.png)](https://www.craftsmensoftware.com/trust-centre)

[![glassdoor (1)](https://www.craftsmensoftware.com/hs-fs/hubfs/glassdoor%20(1).png?width=110&height=79&name=glassdoor%20(1).png)](https://www.glassdoor.com/Overview/Working-at-Craftsmen-EI_IE3004266.11,20.htm) [![goodfirms.co](https://www.craftsmensoftware.com/hs-fs/hubfs/goodfirms.co.webp?width=110&height=95&name=goodfirms.co.webp)](https://www.craftsmensoftware.com/blog/craftsmen-thrives-at-goodfirms-by-offering-scalable-robust-software-solutions-developed-with-quality-by-maestros)

 

 © 2026 Craftsmen. All rights reserved.

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Asif Imtiaj Safi",
    "url" : "https://www.craftsmensoftware.com/blog/author/asif-imtiaj-safi"
  },
  "dateModified" : "2026-04-30T11:17:08.940Z",
  "datePublished" : "2024-04-05T19:00:00.000Z",
  "headline" : "Setting Up a NodeJs/TypeScript CI/CD Pipeline for AWS Lambda Using GitHub Action and Serverless",
  "image" : [ "https://www.craftsmensoftware.com/hubfs/Setting-Up-a-NodeJsTypeScript-CICD-Pipeline-for-AWS-Lambda-Using-GitHub-Action-and-Serverless.webp" ],
  "mainEntityOfPage" : {
    "@id" : "https://www.craftsmensoftware.com/blog/setting-up-a-nodejs/typescript-ci/cd-pipeline-for-aws-lambda-using-github-action-and-serverless",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://www.craftsmensoftware.com/hubfs/Craftsmen%20Logo_Black.png"
    },
    "name" : "Craftsmen Ltd."
  }
}
```

```json
{
  "@context" : "https://schema.org",
  "@type" : "SoftwareCompany",
  "address" : [ {
    "@type" : "PostalAddress",
    "addressCountry" : "Norway",
    "addressLocality" : "Oslo"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "United Kingdom",
    "addressLocality" : "London"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "France",
    "addressLocality" : "Paris"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "United States",
    "addressLocality" : "New York"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "Bangladesh",
    "addressLocality" : "Dhaka"
  } ],
  "areaServed" : [ {
    "@type" : "Country",
    "name" : "Norway"
  }, {
    "@type" : "Country",
    "name" : "Sweden"
  }, {
    "@type" : "Country",
    "name" : "United Kingdom"
  }, {
    "@type" : "Country",
    "name" : "France"
  }, {
    "@type" : "Country",
    "name" : "United States"
  }, {
    "@type" : "Country",
    "name" : "Bangladesh"
  } ],
  "description" : "Trusted AI-native engineering partner providing software team extension, IT staff augmentation, and dedicated developer teams globally.",
  "logo" : "https://www.craftsmensoftware.com/hubfs/logo.png",
  "name" : "Craftsmen Software",
  "url" : "https://www.craftsmensoftware.com"
}
```