Working on product which is served as PaaS, backend of product is completely developed for serverless using NodeJS Serverless Framework and deployed on AWS Lambda.
When I started working on it, I found there are lots of duplicate code, LambdaFunctionOne and LambdaFunctionTwo both have same function performing same operation, and this is the problem if we have to change the logic of function then we will have to change the function in all lambda function.
Wanted to remove the duplicated, so if LambdaFunctionTwo required the some function which is LambdaFunctionOne then instead of replicating, should invoke LambdaFunctionOne and call its function. Suppose created a lambda function for utils and used that utils in every function of Lambda by invoking lambda instead of replicating.
- How does it will affect the pricing?
- Is it good practice to call the lambda from another lambda in terms of cost?
- Is it good practice to develop such product in serverless?