Developing AWS Lambda Functions Locally

How I develop AWS Lambda functions locally using a test-first approach

Marco Lüthy
Geek Culture

--

Photo by Lars Kienle on Unsplash

In this article I share an approach I use regularly to develop AWS Lambda functions (and other serverless projects) locally. It assumes a basic familiarity with AWS Lambda or a similar “serverless” service. The article will first introduce the approach, and then walk through a short example making use of it.

I’ve frequently seen other developers use the “guess and check” approach to AWS Lambda function development: Write some code; deploy and wait a long time; invoke the function; check the result; repeat. This isn’t that surprising given how many guides to developing AWS Lambda functions have you repeatedly deploying or running a command line to invoke it. It’s hardly controversial to say that deploying to check whether code is working as expected sucks big time. It’s also unnecessary once you start treating your Lambda functions as just that — functions, which take simple input and return an output.

AWS Lambda functions are loosely like doing functional programming, albeit rarely pure. I suppose this was the premise in AWS naming the service “Lambda”. Though the functions are hardly anonymous. No matter. When combined with AWS API Gateway, Lambda functions do a very functional-esque thing: map an input to an…

--

--

Marco Lüthy
Geek Culture

Hi there! I’m Marco. I write mostly about software development, sometimes about books I’ve read, and occasionally something else to keep things interesting.