AWS Lambda with Fetch, Lodash, and S3 json file

My Lambda Adventure……………by Rick Delpo 12–11–21

This year (2021) I went Serverless using AWS Lambda and S3 as my data table. OMG, I ditched Java and JQuery in favor of Lambda !

I Love Lambda but don’t especially love the learning curve to get a full app going. Spoiler alert, u can test some simple lambda right inside lambda to drastically reduce the learning curve or u can write a full stack app which is what I am doing.

Recently (2021) I was playing around with React. I needed a change because I am an old dinosaur and have been using JQuery for years. Then soon in, I realized this Serverless craze out there in Dev Land. Since I already had an Apache24 instance on AWS EC2 I started getting curious about how I could use ONLY Lambda and S3 so I could eliminate EC2 and my clunker database.

I dug up lots of Lambda tutorials and immediately found out how to manipulate a Dynamo NoSQL database on AWS. This NoSQL idea started nagging me because I am very old school and have been using MySQL for ions. I was also playing around with Axios on the front end as my http client.

Then it dawns on me that data is always rendered in JSON and that NoSQL is also JSON. But using Dynamo was getting to me so I thought I would cut to the chase and do NoSQL with JSON directly in S3. Why not make S3 my database? I thought. There are more reasons not to do this than to do, but I am experimenting here.

I also ran into rendering problems in React. Array.reduce was taking too long on large tables. Hellooo….introducing Latency and Cold Starts. At first I got real discouraged with Lambda because of Latency but I found a way around it all and my SQL background helped immensely here. I discovered that Lodash was a more user friendly way to write reduce code. Objective here is to have a nice reduced view of my data, a dashboard view so to speak. A much condensed view of the data. But to do all this with Dynamo became unwieldy and complex, not to mention pricey. So I thought of a down and dirty S3 approach where I insert new data, save, fetch, reduce and save again all in the background with a small Lambda program.

Since I was new to Lambda this project seemed very daunting at first. But I was not new to ad hoc requests from my team mates at work. When they request a certain view of the data they simply want it on a dashboard and they never seems to care how I make this magic work. They just want it and they want it now. Since many of these ad hoc requests most always only involve 1 table that constantly gets updated and re rendered I figured S3 and Lambda would do the trick, and it turns out that I was right about this.

At the same time, though, I was finding React kind of complicated so I opted for just a plain vanilla javascript front end. Excuse me all of u out there but sometimes, based on the requirement, we just need to break some rules. Also PS I was using react without Node anyway with the Babel library. There was another insidious thing going on too. Babel was setting a cookie and i just spent the last 2 years trying to be cookie free.

By now folks, I am sure u just want to see some code so I can show u my Lambda right now

Then there are all the little caveats and obstacles u need to know about how to actually get this all up and running in AWS.

Examples of gotchas and caveats


1 In Lambda we need to import 2 node libraries

2 we also need an api gateway in AWS to provide a link to Lambda

3 we need a json file in S3 and need to know how to write to this file

4 beware of AWS IAM permissions…as they are always a problem for beginners

5 Newsflash!! BTW we also need AWS style SSL and a Cloudfront distribution

6 and DNS pointed to AWS route53…..had enough yet?

Hold on there pardner !!! way too much information…there is no way I can teach all of this without going on a massive tangent and it is overwhelming at first but we gain much satisfaction after crossing this hurdle because it catapults us right into modern day 2020s Serverless Knowhow.

Remember this is all just to get some Lambda going. But don’t u as a developer want to be cutting edge? I do and for me this is all in the rear view mirror now. Take a deep breath and convince urself that this endeavor is a must do.

BTW…..all the above is on a Windows platform..I don’t have a clue about doing this in Linux or whatever else is out there.

Now for my front end code

More to come soon !

Original content can be found at

or Google Rick Delpo and find me out there on the Web

Happy Coding !



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rick Delpo

With 20 years experience in web dev and data management, Rick has witnessed the entire evolving of the web. Now offering FREE tutorials for beginners.