0
votes

I am new to serverless framework, I used to create and write lambda codes through aws console. But I am little bit confused about the serverless framework structure. Should I need to create a serverless yml for each lambda function, Or I can use a single yml file for my whole aws lambda functions? I don't know which is the best way to start, because each api gateway end point will point to different lambda functions. Please suggest the best way to start.

1
It depends on your use cases on how you want to define microservices but yes, a single serverless yml file should be enough for all the lambda functions in your single project - Deekshith Hegde

1 Answers

0
votes

My few cents here, based on some experience in the last 6 months. I started using a single Git repo with all lambda functions each in a folder. During the first 2 months, I had a single YML file to define all functions.

Then after some issues, I moved to separate YML files inside each folder for lambda function.

  1. You can use plugins specific to each functions. In my use case, I had a NodeJS and GraphQL function for which I use Webpack for compressing the packages.
  2. The Webpack didn't work for my other function which uses some pre-built binary for running specifically in AWS.
  3. Not all functions need to be deployed every time. So managing in separate folders gave lot of flexibility in CI/CD and deployment version management. Otherwise, you will have releases for all functions.