Live data from Hacker News

Should you use a Lambda Monolith, a.k.a. Lambdalith, for your API?

rehanvdm.com

71–80 of 131 posts

Re: Should you use a Lambda Monolith, a.k.a. Lambdalith, for your API?

#71

If you're going to put everything in a single lambda function that's continually serving HTTP requests, you might as well look at ECS.

ECS doesn't a) scale to zero b) scale up to infinity near-instantly. Source: I've rand both a Lambda Monolith and ECS on production and would pick Lambda any day

Just FYI: You can totally scale ECS down to zero. Our ECS bill hovers around $1/mo because we spin it up on demand based on queue size (It takes a painfully long time to spin up, though).

Re: Should you use a Lambda Monolith, a.k.a. Lambdalith, for your API?

#72
post #64

Earlier quoted context omitted.

I've experienced ansible for managing a fleet of multiple hundred on-prem servers and now I'm experiencing CDK for managing a large infrastructure. Both suck real bad. Infrastrucure is hard, thankless work. Complexity blows up whatever you do.

You literally can tell ChatGPT to create a CDK typescript app that deploys a lambda + API Gateway where the lambda works with Get request and a dynamodb table. The lambda should have permission to read and write to the Table and it will get you 95% there. Edit: I just did it with ChatGPT 4 expecting it to just create the CDK app. It actually created inline Node sample code as part of the construct for the actual lamb…

I've found that "permissions" are what bites most developers. It's always either IAM or security groups...

Re: Should you use a Lambda Monolith, a.k.a. Lambdalith, for your API?

#74

Earlier quoted context omitted.

You literally can tell ChatGPT to create a CDK typescript app that deploys a lambda + API Gateway where the lambda works with Get request and a dynamodb table. The lambda should have permission to read and write to the Table and it will get you 95% there. Edit: I just did it with ChatGPT 4 expecting it to just create the CDK app. It actually created inline Node sample code as part of the construct for the actual lamb…

I've found that "permissions" are what bites most developers. It's always either IAM or security groups...

Using the ChatGPT prompt I said above, it did the permissions correctly

    table.grantReadWrite(lambda function)
Just as an experiment, I’ve thrown Lambda code I’ve written from scratch into ChatGPT and asked it what permissions it needed. It got it right.

ChatGPT is well trained on everything AWS related. It can transform CloudFormation to idiomatically correct CDK or Terraform.

I hate to say this because it sounds like an appeal to authority. But I really want to set context. I used ChatGPT for projects while I was working at AWS ProServe and since I left. They were generic utility scripts with no proprietary business related code.

Re: Should you use a Lambda Monolith, a.k.a. Lambdalith, for your API?

#75
post #60

I worked on a small SaaS that deployed in this way. The AWS bill was about 10x what it would have been if they had just deployed nodejs on an EC2 instance.

There's obviously a static load level where it makes more sense to have an always-on server vs. a FaaS and you need to monitor that boundary point. The point of doing something like this "Lambda Monolith" is that transitioning to an always-on server is trivial. I've been doing this exact setup for a while and our static costs basically evaporated. Seeing your costs drop below a dollar/month on a project you are build…

I just can't get my head around this argument of 'scales to zero'.

If you have one or more professional developers working on a project how can you be bothered about an extra $20-$200/month when you know you'll also be spending a couple of engineering hours (worth more than $200) on migrating later?

Re: Should you use a Lambda Monolith, a.k.a. Lambdalith, for your API?

#76
post #62

Yes, but not only API... We figured out how to get Azure Functions to serve a complete webapp without any extra crap wrapped around it. No gateways/proxies/etc. One function that serves the root URL[0] and has conditionals for GET/POST methods. Beyond this point, anyone with old-school mastery of HTML/CSS/JS can get the rest of the job done with basic-ass SSR and multipart form posts. For data, we just use Azure SQL…

Why would you ever do this instead of just storing your static assets in the Azure equivalent of S3 and let it do the heavy lifting along with the CDN?

Re: Should you use a Lambda Monolith, a.k.a. Lambdalith, for your API?

#77
post #62

Yes, but not only API... We figured out how to get Azure Functions to serve a complete webapp without any extra crap wrapped around it. No gateways/proxies/etc. One function that serves the root URL[0] and has conditionals for GET/POST methods. Beyond this point, anyone with old-school mastery of HTML/CSS/JS can get the rest of the job done with basic-ass SSR and multipart form posts. For data, we just use Azure SQL…

I bet you were running c#. Been pulling my hair out with the python support in Azure Functions lately (starts with no local emulation on mac, but positively this got me to start using VS code server and https://github.com/coder/coder ) .

Re: Should you use a Lambda Monolith, a.k.a. Lambdalith, for your API?

#78
post #62

Yes, but not only API... We figured out how to get Azure Functions to serve a complete webapp without any extra crap wrapped around it. No gateways/proxies/etc. One function that serves the root URL[0] and has conditionals for GET/POST methods. Beyond this point, anyone with old-school mastery of HTML/CSS/JS can get the rest of the job done with basic-ass SSR and multipart form posts. For data, we just use Azure SQL…

I bet you were running c#. Been pulling my hair out with the python support in Azure Functions lately (starts with no local emulation on mac, but positively this got me to start using VS code server and https://github.com/coder/coder ) .

Yes. C#/V4 functions. I've been working with the in-process model, but close to validating our app works on the isolated worker model too.

Re: Should you use a Lambda Monolith, a.k.a. Lambdalith, for your API?

#79
post #62

Yes, but not only API... We figured out how to get Azure Functions to serve a complete webapp without any extra crap wrapped around it. No gateways/proxies/etc. One function that serves the root URL[0] and has conditionals for GET/POST methods. Beyond this point, anyone with old-school mastery of HTML/CSS/JS can get the rest of the job done with basic-ass SSR and multipart form posts. For data, we just use Azure SQL…

Why would you ever do this instead of just storing your static assets in the Azure equivalent of S3 and let it do the heavy lifting along with the CDN?

We are B2B at the scale of 1-10k users. There is no "heavy lifting" to do in our contexts of use. Serving static assets along with the SSR content is totally acceptable. They aren't even served as separate files. We inline everything into 1 final HTML payload always.

Our largest assets are SVG logos that our clients bring to the party. We do work with dynamic PDF documents, but these are uncachable for a number of reasons.

Hypothetically, if we had millions of users and static asset IO was actually causing trouble, we'd consider using a CDN or other relevant technology.

Re: Should you use a Lambda Monolith, a.k.a. Lambdalith, for your API?

#80
post #65

Earlier quoted context omitted.

ECS doesn't a) scale to zero b) scale up to infinity near-instantly. Source: I've rand both a Lambda Monolith and ECS on production and would pick Lambda any day

Do you scale to zero for the resume achievement or to actually save money?

To actually save money. Mostly due to not needing to have a 24/7 team managing it.

AWS Lambda NEVER goes down. And if it does, it's most likely someone messing with DNS or backbone routing again and half the world is broken anyway.

It does need skill though, the billing model isn't as clear as "you pay me X euros a month for a server, I don't care what you do with it", but it's not dark magic either.

Post reply on HN