Ways To Iteratively Develop Lambda Functions
Published: 2023-08-25 09:34:28

---
title: Ways To Iteratively Develop Lambda Functions
published: true
date: 2023-07-31 11:26:04 UTC
tags: 
canonical_url: https://blog.letsdote.ch/p/ways-to-iteratively-develop-lambda
---


 ![minimalist photography of three crank phones](https://images.unsplash.com/uploads/1413222992504f1b734a6/1928e537?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wzMDAzMzh8MHwxfHNlYXJjaHwxOXx8dGhyZWV8ZW58MHx8fHwxNjkwNzUyNTk3fDA&ixlib=rb-4.0.3&q=80&w=1080 "minimalist photography of three crank phones")
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewbox="0 0 24 24" fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg>


_Photo by Pavan Trikutam on Unsplash_

Thanks for sending in all those B-Day wishes. I had some travel plans due to the same occasion and that also explains the delay in sending out this email update.

The last week was a short one - work wise. During my travel, I contemplated about the serverless things I did right, and also the wrong ones in this month. One aspect of serverless development I want to make better is the iterative development process.

### What have I used till now?

To develop and deploy the Lambda functions alone, you don’t need much - as far as you are just trying out with something like NodeJS - where the code editor is supported. In case of Golang you have to develop the code locally, build it, and then upload the binary to the Lambda function.

Building the binary is indeed an additional step in developing Lambda functions with Go - some even frown upon - but it is also [a performance booster](https://dev.to/letsdotech/goroutines-to-improve-aurora-serverless-v2-performance-via-lambda-o9n-temp-slug-9085735).

Performance matters in the world of pay-per-use. A 10x improvement in performance roughly means the same extent of reduction in cloud spend.

To have a defined development cycle, for the last couple of months I have used Terraform and Amplify mainly to create and deploy Lambda functions, and a couple of days back I tried AWS SAM (Serverless Application Model) to have the taste of managing Lambda functions.

1. Terraform - I created my own boilerplate IaC to take the Go source code and build a lambda function out of it. This is by far my favourite way to manage lambda functions till now. It might not be the easiest, but I do plan to manage almost all components in all environments using Terraform - so doing the Lambda functions as well make a lot of sense.

2. Amplify - I was in search of an easy frontend development and hosting solution. Amplify fits the bill perfectly for the same, but it also creates certain backend components to support the frontend - like Appsync, DynamoDB, Lambda functions, API Gateways. Initially [I tried to make peace with Amplify](https://dev.to/letsdotech/breaking-beliefs-with-aws-amplify-3p8i-temp-slug-6145492), but later it became difficult to draw a line of management between the backend components created by Amplify and the ones created by Terraform.

3. SAM - the tool I have least experience on, but still found it to be of great use considering its local testing feature. Out of all the approaches I have tried so far, the local testing function offered by SAM is great.

### Why didn’t I use serverless framework or Cloud Formation Templates?

You can call me a fanboy if that is what they say, but I have spent quite some time with Terraform and I am very comfortable with it. Learning parallel technologies is not the best use of time.

I wanted to try the serverless framework out of FOMO, and did go through the documentation. It is a great solution. But for me personally, it would have been either this or that (Terraform). For all my IaC needs, Terraform fits the bill, but I was not sure about this in case of the serverless framework. I am still unsure if the serverless framework is used to create just the functions or other cloud resources as well?

The story is similar for CloudFormation templates. Additionally, it being AWS specific discouraged me even more.

One may point out Amplify uses CloudFormation Templates under the hood. That is exactly what I want - as far as it is being used under the hood and I still get to manage the resources I intend to, I am good. There is no enemity with any tool, I promise. 😂

### So, the plan.

I might want to explore other solutions given the limitations of currently chosen ones (if I find them), and I will do so if required. But for now, this is the plan.

For the long term and scaled IaC requirement for Lambda functions (and other cloud resources as well!), I plan to use Terraform.

I still use Amplify for frontend solution, but with a rule of not creating ANY backend components via the same. Amplify is strictly used for managing React components and occassional integration with Figma. All the backend components like Lambda functions, DynamoDB, API Gateway - required by the frontend - will be managed via Terraform.

For the local development or trying out PoCs, I plan to use SAM since it allows for local execution and quick testing. I am not well versed with it but will soon be.

### Your thoughts

I am keen to listen to your thoughts. Would there be a better way to achieve quicker interations for Serverless development?

Sumeet N.