Skip to content
Soroka Tech Blog

When less is more in Serverless world

devops, aws, serverless, lambda1 min read

Banner Image

In the complex business landscape, sometimes composing AWS Lambda functions with the mindset of doing one thing at a time will mean writing the input/output transformation. For that one will need to add function code to the repository, add rules for provisioning it and make sure that it is working. There are multiple ways of not writing any implementation code for achieving your business goals with the software application.

VTL (Velocity Template Language) for the rescue. If you are already using API Gateway for standard REST API, consider applying request/response mapping of the triggering event. It will help to strip the payload even before starting lambda. If there is a GraphQL with the AppSync - do the VTL resolvers with the data sources like DynamoDB (for NoSQL) or HTTP to call anything you want with no code.

comparison

Let's consider the situation where user will need to get an item from DynamoDB. There is a choice to it via writing AWS Lambda function (on the left part) or doing it via VTL (on the right). Even the fastest runtime of Lambda will take some time to initialize. The template version will decrease your latency between the sending request and response dramatically. It is the small change that will improve the usability of the application in just 9 lines of request transformation.

Contact me concerning serverless-related questions. Follow me on Twitter for content like this below.

Twitter

© 2022 by Soroka Tech Blog. All rights reserved.
Theme by LekoArts