Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to define a common env variable in aws lambda layer?

I use serverless framework and I have multilple aws node.js lambdas that share the same layer. I want to define an ENV variable for all of them-is there a way to put that common ENV variable into the layer's serverless.yml? Or do I have to go and put it in each serverles.yml files separately?

like image 484
Capaj Avatar asked Mar 26 '20 14:03

Capaj


1 Answers

To deal with env variables in my lambdas i use this plugin https://www.npmjs.com/package/serverless-dotenv-plugin

It looks for a .env file use it as a reference to your env variables.

plugins:
  - serverless-dotenv-plugin

Hope it helps.

like image 90
Nivardo Albuquerque Avatar answered Nov 15 '22 00:11

Nivardo Albuquerque