Skip to content

Lambda Layers for NodeJS - An Example

twitter logo ・1 min read  

nsriram / aws-lambda-layer-example

aws lambda layer example

Lambda Layers for NodeJS - An Example

This article outlines the steps involved in building a node js lambda using lambda layers for library dependencies, using AWS CLI.

The example will build a lambda function that will return current time using momentjs library. The lambda will not bundle momentjs via package.json, node_modules, but will use momentjs via lambda layers.

Following are assumed to be available on your computer.

  1. AWS Account
  2. IAM Role to manage and execute lambda functions
  3. AWS CLI version 1.16.69

1 : Create and publish momentjs lambda layer.

What is a lambda layer (Source: AWS Docs) : A layer is a ZIP archive that contains libraries, a custom runtime, or other dependencies. With layers, you can use libraries in your function without needing to include them in your deployment package.

1.1 Create an empty nodejs project.

> cd ~
> mkdir momentjs-lambda-layer
> cd

twitter logo DISCUSS
Classic DEV Post from Jun 18 '19

Discussing the launch of Libra, "A new global currency"

A thread to talk about the launch of Libra

Sriram Narasimhan profile image