Introduction:
Microservices and Serverless Architecture have changed the web applications paradigm in many ways — Architecture,Deployment, Cost etc. In this article I’ll share the ways to structure a Serverless application in terms of deployment and the options to invoke them.
The patterns of serverless are still evolving however there are some major patterns we are seeing across the industry. These patterns have to be chosen as per the project requirements.
The capabilities of serverless have been changing dramatically, opening up a ton of new patterns and possibilities. This write up is intended to capture and share the patterns / practices being used in serverless production applications today.
A. Deployment Patterns:
Here I’m going to cover what are the ways you can deploy a serverless application.
- Microservices Pattern
In this pattern each job or functionality is deployed within a separate Lambda function.Each Lambda function would have a single http endpoint that serves as the entry point for that function.
2. Services Pattern
In the Services Pattern, a single Lambda function can handle a few (~4) jobs that are usually related via a data model or a shared infrastructure dependency. multiple HTTP endpoints are created for each data model. For example one HTTP endpoint for users management another HTTP endpoint for Comments management
3. Monolithic Pattern
In the Monolithic Pattern your entire application is wrapped in a single Lambda function. The entire app is in a single Lambda function, all HTTP endpoints point to that Lambda function
Example structure with YAML:
Comparison Matrix:
B. Invocation Patterns: