- Newest
- Most votes
- Most comments
multiple routes in the same lambda
It's possible, but it contradicts the micro-services paradigm. It's better to split the logic into different Lambda functions. Functions should be decoupled if possible (e.g., using a queue). In this case, you can scale and monitor all parts of the application independently.
Due to some business reasons, each group of resources are directed to the same lambda function.
if this approach can not be changed, that's ok
Is there any security aspect we should consider ?
if you split one function into many, you can create permissions for every small function according to the Least Privilege Principle
How will it affect the performance?
smaller functions load faster and are cheaper at the end
Thank you for your answer but what do you think of modifying the event in API Gateway and dynamically call the controller inside lambda with its respective function instead of routing inside the lambda function ?
You can try this, but it's complicating the architecture. The simpler thing is to use different API Gateway routes to different Lambda Functions
Relevant content
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
please accept the answer if it was useful