Hi there,
I’m pretty new to serverless framework and AWS, therefore I have some questions on general nature, before the project ends in a mess We plan to have a quite large REST-API (maybe 100 “routes”) on AWS Lambda nodejs, but there are still some questions left from my side.
-
Does it make sense to use one service function for the whole API? Like for example https://serverless.com/blog/serverless-express-rest-api/ This would reduce in my eyes at least the problem with cold starts (because there will be only 1 generic lambda instead of hundreds). On the other hand, this will cause problems with documentation and also prevent us deploying some services/functions only
-
From what I see, each function in serverless creates one specific lambda version. Which leads me to the problem already mentioned above. Cold starts. I’m not sure if i should be afraid of it, but I heard some stories. Would it make sense to reduce the code size here for each function? For example only include the NPM packages which are needed by this specific function? If so, how could this be accomplished? NPMs bring a lot of dependencies, so i will have to have huge lists of what to include where.
-
How does serverless packaging work in general? Do i have to install my NPM packages locally exactly in the node version which is offered remote? Where and when is the “npm install” performed?
-
Is there any larger API project in nodejs/serverless which i can take as a reference for code structuring?
-
Whats the recommended deployment process with serverless? I ready everywhere about the CLI deployment, but that about ci/cd? HOw to integrate serverless here, or does it not make that much sense? Any articles on this, my research did not find anything relevant
-
What about Database connections and similar? Should they be persistant or closed after function call? From what i see it would make sense to keep them open, as long as the lambda container is up and running
Okay, a lot of questions, maybe someone has any clue about any topic here, I would be really glad.
Thanks!