Simplifying operations
To further simplify the operational efforts needed to run, maintain, and monitor microservices, we can use a fully serverless architecture.
Deploying Lambda-based applications
You can deploy your Lambda code by uploading a zip
file archive or by
creating and uploading a container image through the console UI using a valid Amazon ECR image
URI. However, when a Lambda function becomes complex, meaning it has layers, dependencies,
and permissions, uploading through the UI can become unwieldy for code changes.
Using AWS CloudFormation and the AWS Serverless Application Model (AWS SAM
To deploy, specify resources and permissions policies in a CloudFormation template, package deployment artifacts, and deploy the template. SAM Local, an AWS CLI tool, allows local development, testing, and analysis of serverless applications before uploading to Lambda.
Integration with tools like AWS Cloud9 IDE, AWS CodeBuild, AWS CodeDeploy, and AWS CodePipeline streamlines authoring, testing, debugging, and deploying SAM-based applications.
The following diagram shows deploying AWS Serverless Application Model resources using CloudFormation and AWS CI/CD tools.

Figure 2: AWS Serverless Application Model (AWS SAM)
Abstracting multi-tenancy complexities
In a multi-tenant environment like SaaS platforms, it's crucial to streamline the intricacies related to multi-tenancy, freeing up developers to concentrate on feature and functionality development. This can be achieved using tools such as AWS Lambda Layers, which offer shared libraries for addressing cross-cutting concerns. The rationale behind this approach is that shared libraries and tools, when used correctly, efficiently manage tenant context.
However, they should not extend to encapsulating business logic due to the complexity and risk they may introduce. A fundamental issue with shared libraries is the increased complexity surrounding updates, making them more challenging to manage compared to standard code duplication. Thus, it's essential to strike a balance between the use of shared libraries and duplication in the quest for the most effective abstraction.
API management
Managing APIs can be time-consuming, especially when considering multiple versions,
stages of the development cycle, authorization, and other features like throttling and
caching. Apart from API Gateway
Figure 3 illustrates how API Gateway handles API calls and interacts with other components. Requests from mobile devices, websites, or other backend services are routed to the closest CloudFront Point of Presence (PoP) to reduce latency and provide an optimal user experience.

Figure 3: API Gateway call flow