3

I'm using claudia.js CLI to deploy functions and web API to AWS lambda and API gateway. My project files structure is as follow:

functions
--function1
---- node_modules
---- package.json
---- index.js
---- claudia.json
--function2
---- node_modules
---- package.json
---- index.js
---- claudia.json

The problem is that in order to update new version I have to run "claudia update" in every function folder...so I have to run it once for every function (in every folder). Is there a way to tell claudia.js to update all my functions at once?

Zanon
  • 29,231
  • 20
  • 113
  • 126
Assaf Sheep
  • 563
  • 1
  • 4
  • 16
  • Claudia can't update multiple functions out of the box. The question is if you really need to update all the functions at the same time? In most of the projects with multiple Lambda functions I worked on, functions were independent and I was deploying only the function I changed. If you do need to update multiple functions at the same time you can create a script, to do that for you, or if you have a lot of functions it might make sense for you to use CloudFormation (Claudia doesn't support it). – Slobodan Stojanovic Jan 05 '18 at 08:06

2 Answers2

0

Rather than getting ClaudiaJS to do the work, use a tool to run ClaudiaJS. Most monorepo tools will suffice, such as Lerna but there is gamont of less opinionated tools if you don't care for what Lerna offers - Lolaus is pretty low-level.

With Lerna you would need to use the prescribed repo structure, get linked node_modules, and lerna run deploy would run the npm deploy script of each package that has it.

With Lolaus you would search for all of your functions and then run an arbitrary command in each directory: lolaus "*/*/caudia.json" claudia update

Tom
  • 981
  • 11
  • 24
0

We have a lambda repo with multiple replate lambdas, each in its own subfolder.

> lambdas 
> |_lambda1
> |___main.js
> |___main.spec.js
> |___claudia.json
> |___package.json
> |_lambda2
> |___main.js
> |___main.spec.js
> |___claudia.json
> |___package.json
> |_helpers
> |_test.sh
> |_deploy.sh

We use npm and a bash script to iterate over each lambda and run a consistent set of npm/eslint commands on them. If that passes the build process we run a claudia command the same way on each lambda. There is some cut and paste

Eric Aldinger
  • 125
  • 1
  • 6