DEV Community

Raghavendra
Raghavendra

Posted on

Split Larger Serverless Application in to smaller micro-apps

Serverless applications are great because they remove the burden of maintaining the server, thus allowing developers and startups to focus on code instead of infrastructure. But what happens when the serverless application grow bigger? This article describes the strategies to maintain larger serverless applications.

This article is about AWS SAM Applications. Terraform has modules to handle this use case. For other serverless platforms, let us discuss them in the comments

1. Nested Applications
Using the AWS::Serverless::Application, one can create a giant serverless application by combining the smaller applications recursively.

  • PROS
    • Native Support by AWS SAM.
    • Share applications using a file-system share or AWS Managed SAM Repository.
    • Deploy and Test the nested application independently.
  • CONS
    • Parameter passing between nested applications is difficult to manage.
    • Common dependencies create duplicate resources. For example, if applications A and B include application X, another application using both A and B will have two instances of X.
    • Extending an application is not possible. For example, application A which includes application B can not update the properties of a resource in application B.

2. Using SOMOD
With SOMOD(Serverless Optimized MODules) framework, create Serverless applications in smaller chunks and merge them to form bigger solutions on multiple levels.

  • PROS
    • Each Module is an NPM Package giving the inbuilt feature to manage the dependencies.
    • Easy Parameter management.
    • No Duplicate resources.
    • Can update only selected resources from dependency modules.
    • Extendable framework
  • CONS
    • Need NPM as package/dependency manager.
    • Some extra conventions to learn (easy learning curve)

Getting Started with SOMOD section in the SOMOD documentation has a step-by-step guide to work with SOMOD.

Top comments (0)