Live data from Hacker News

Serverless dev practices questions

news.ycombinator.com

1–10 of 30 posts

Serverless dev practices questions

#1
Hi guys, So after spending some time exploring serverless practices (Lambda in particular), a few questions popped into my mind which i’d love to get some more experienced views. The development guidelines seem to be quite straightforward for some simple stuff to do and the given sample code demonstrate it nicely. Yet - what happens when the overall application isn’t as simple and requires more than 15 lines of code? Building the design and logic of the app shouldn’t be that hard, yet making sure that it actually works is what worries me more… What are the given practices to test, debug, troubleshoot and iterate with the code i write in Lambda? The best i came up with is traces and log collection (most common), wrappers for the code in Lambda to collect more metrics and SAM local which should allow you to run stuff locally (but then, how to simulate the real context and the flow of the app)... are these really enough to test code in Lambda? Are there any other options around? Are there any other outstanding issues in developing for for Lambda?

Re: Serverless dev practices questions

#4
AWS Lambda is a very small interface. I'm only getting started, but I'm planning to keep all my application code in a separate project with no Lambda dependencies, test that as I would any application, and then have a thin wrapper that just wraps each endpoint in the Lambda interface.

This would also maintain as loose as possible coupling to the Lambda ecosystem, making porting easy -- I'm in Java-land, so that probably means Dropwizard. I'm not there yet, but I'm planning to maintain a parallel Dropwizard wrapper, to make local dev easy.

Re: Serverless dev practices questions

#6
post #5

I have a very large application implemented as one single lambda python function. Works great.

Please define "very large". When I think large app, I think at least a few hundred endpoints split across tens of thousands of files. How can you have a very large app with a single endpoint? Could you elaborate?

Re: Serverless dev practices questions

#7
post #6
post #5

I have a very large application implemented as one single lambda python function. Works great.

Please define "very large". When I think large app, I think at least a few hundred endpoints split across tens of thousands of files. How can you have a very large app with a single endpoint? Could you elaborate?

A single lambda function doesn't mean a single endpoint.

The lambda function gets the request, looks at the url and routes based on that

Re: Serverless dev practices questions

#8
I would recommend splitting out the lambda-entrypoints from the rest of your app, so that you can test it separately.

Personally, I've found it tough to test full integrations where I'm depending on cron jobs, work queues and notifications. I felt like I was writing an awful lot of code just to be able to fake all these integration points, which meant that in reality there was a lot of behavior that wasn't really being tested.

Re: Serverless dev practices questions

#9
post #6
post #5

I have a very large application implemented as one single lambda python function. Works great.

Please define "very large". When I think large app, I think at least a few hundred endpoints split across tens of thousands of files. How can you have a very large app with a single endpoint? Could you elaborate?

Ok we have very different definitions of very large. I mean s complete full featured SAAS workflow application.

I don't actually use the AWS HTTP API gateway. I control the front end entirely so my UI just talks direct to lambda. It's very simple - instead of futzing around implementing REST API mapping layers I just connect all my front end functions to a single lambda function and specify in the params the name of the python function I want to run. Super easy.

Even if you wanted to use API gateway you could still map all the end points to one single application and dispatch based on the route/URL.

I can make a solid recommendation to anyone use lambda .... seriously consider using Cognito for your user management.

There's no reason why you couldn't have tens of thousands of functions in the same function, in fact probably a good idea.

Re: Serverless dev practices questions

#10
post #9
post #6

Earlier quoted context omitted.

Please define "very large". When I think large app, I think at least a few hundred endpoints split across tens of thousands of files. How can you have a very large app with a single endpoint? Could you elaborate?

Ok we have very different definitions of very large. I mean s complete full featured SAAS workflow application. I don't actually use the AWS HTTP API gateway. I control the front end entirely so my UI just talks direct to lambda. It's very simple - instead of futzing around implementing REST API mapping layers I just connect all my front end functions to a single lambda function and specify in the params the name of…

> seriously consider using Cognito for your user management.

Can you please expand on that recommendation? I tried and found it profoundly opaque, and eventually gave up in favour of auth0. I specifically wanted to use the hosted login/sign-up forms.

Post reply on HN