Publish simple Node.js AWS Lambda layer

Let’s provide axios as a Lambda layer

Prerequisites

  • AWS account
  • npm
  • zip

1. Create folder

mkdir nodejs
cd nodejs

2. Install dependency

npm install axios

3. Zip contents

cd ..
zip -r axios.zip nodejs

4. Publish to Lambda layers

Create new layer
Add previously created axios.zip
Copy full ARN since we will need it in the next step

5. Add to existing Lambda

Open existing lambda and click to add a layer
Add layer via previously added ARN

6. Let’s check if it works

It pulls info from public API using axios

You can find list of commands down below:

--

--