4 ms·
> What captured people's imaginations about AWS Lambda is that it lets you a) give any piece of code an URL, and b) that code doesn't consume resources when it'
by politelemon 2y ago
> What captured people's imaginations about AWS Lambda is that it lets you a) give any piece of code an URL, and b) that code doesn't consume resources when it's not being used. Yet these are also exactly the attributes possessed by PHP or CGI scripts. In fact, it's far easier for me to write a PHP script and rsync it to a web server of mine than for me to figure out the extensive and complex tooling for creating, maintaining and deploying AWS Lambda functions — and it comes without the lock-in to boot. Moreover, the former allows me to give an URL to a piece of code instantly, whereas with the latter I have to figure out how to setup AWS API Gateway plumbing correctly. I'm genuinely curious how many people find AWS Lambda interesting because they've never encountered, or never properly looked at, CGI.
Well, assuming you are genuinely curious and not just using an expression!
The difference is that the 'web server' is still consuming resources when the code is not in use. They aren't equivalent at all. The web server is hosted on an OS and both require ongoing maintenance.
Further, the appeal of Lambda is in its ease of onboarding for newcomers; I can run a piece of .NET or JS or Python locally and directly without a lambda 'layer' to host it, just invoke the handler method.
I'm not sure what complex tooling that the author is referring to though, it's a zip and push.
- icedchai 2y agoOnce you add API gateway, IAM roles/permissions, VPC, security groups, it gets a lot more complicated. Then you want to host a static web site, reverse proxying to API gateway, add CloudFront, WAF, etc. You'll go crazy setting this up manually, so you'll also want Terraform or CloudFormation to make it repeatable. For anything complex, you'll run into "slow start" issues and have to look at provisioned concurrency. Lambda also sucks for dependencies. Zips and "layers" can only be so large. Eventually you'll hit the limit and have to move to containers. There are also other limitations, like payload sizes. Eventually you might run into that, too. Also, it would be nice if Lambda just reused the CGI interface instead of inventing its own thing.
- owenversteeg 2y agoYeah, it's an absolute explosion of complexity, and with it comes the risk that you miss something and are faced with a security issue or giant bill or both. What I would kill for is something in between all of this and FTPing PHP around like it's 1999. I've hunted for years for middle-ground solutions and haven't found anything. Security, cost, performance etc are important, sure, but what I really yearn for is a simple, easy, bulletproof solution like the days of yore when a handful of simple scripts could chug on for decades. Two decades ago you could set up a simple site that needed no attention for twenty years. Today's technologies require constant attention and updates and if you blink then everything requires an update that's not compatible with your code. Meanwhile, PHP from 2004 can be trivially run in 2024. What's the PHP-and-FTP of today? Does it exist?
- denton-scratch 2y ago> Two decades ago you could set up a simple site that needed no attention for twenty years. ...but as of yesterday, you can't?
- twobitshifter 2y agoHave you seen https://www.val.town/ https://www.val.town/ ?
- llm_trw 2y agoIt's still php-and-ftp. Sometimes I get fancy and use python and ssh.
- icedchai 2y agoI was going to say the same thing. I generally use Laravel instead of "raw" PHP these days, but still...
- ArneBab 2y agoI nowadays mostly use a simple static website plus minimal Javascript, but I still have PHP sites. It still works. And PHP today is at least factor 3 faster than PHP was back then — on the same hardware. So maybe just use PHP and ftps or sftp?
- inopinatus 2y ago> nice if Lambda just reused the CGI interface Lambda is an event-driven system; synchronous, stateful request/reply for HTTP is shoehorned onto that. At heart it's a scale-out queue processor, not a web server. This whole "lambda gives your code a URL" folks speak of, is actually an API Gateway thing. This is also why Lambda has at-least-once semantics rather than that at-most-once, which definitely surprises the casual web developer from time to time ("why did that happen twice??"). That said, I don't disagree with the sentiment; it would be quite nice if API Gateway had a simple option to map incoming request parameters to CGI-like attribute names in the event payload.
- chasd00 2y agoIn a lot of these discussions the point gets raised about the work to maintain a self-hosted server. When i've done it I install the os (usually ubuntu server), turn off unused services, setup the firewall to only allow required ports, and then it just sort of sits there and does its thing. Uptimes have been measured in years in some cases and the server just sits there happily serving whatever html and connecting to whatever db forever.
- pixl97 2y agoI mean, typically hosting a static site that's fine, but with the number of exploits these days and the ability for people to chain them together, maybe you don't even realize your box has been exploited? Uptimes in years means your box, especially without updates has something it could be targeted with.
- graemep 2y agoMost of those that are find for a static site but not dynamic are those that are not fixed by just applying updates from the distro. You still need to update your app code even if you are using someone elses servers, so its the same either way.
- pixl97 2y agoNote that the parent said "uptimes measured in years", so they are either using a more complex system with multiple servers, or they are not doing security updates.
- graemep 2y agoI agree I would not endorse uptimes measures in years, which means not doing kernel updates - but OP does qualify that with "in some cases".
- josephcsible 2y agoDo you enable unattended upgrades and kernel live patching? If not, then that doesn't seem secure.
- jacobgkau 2y ago> They aren't equivalent at all. The web server is hosted on an OS and both require ongoing maintenance. From a technical standpoint, surely the servers running Lambda have an OS and require maintenance internally by Amazon at some level (even if it's dev-ops-abstracted away for their operators). It's just their responsibility instead of yours, and it's also their responsibility to find other work for those servers when your code isn't running (or bear the cost of an idle server). It's like if they were letting you push PHP functions to their web server, using the quoted comparison. Useful from a business standpoint, yes. Revolutionary, maybe not as much as it seems at first glance. That's the takeaway I got.
- Joker_vD 2y agoAnd, of course, they don't just "bear the cost of an idle server". Just like any other fixed costs in any other industry, those costs get smeared over the charged prices. Unless there is some serious economy of scale (i.e. ops at Amazon managing to handle the upkeep of a 1000 of their servers for less than 1/1000 it costs you to manage 1 of your server), you're ending up paying somewhat more. But then again, you don't have to spend time to manage your own server which is probably a positive trade-off.
- lompad 2y ago>> somewhat It's a factor of 5 to 20 [1] in many cases. Regular hosting is unbelievably cheap, especially in high traffic environments. [1] https://tech.ahrefs.com/how-ahrefs-saved-us-400m-in-3-years-by-not-going-to-the-cloud-8939dd930af8 https://tech.ahrefs.com/how-ahrefs-saved-us-400m-in-3-years-...
- Uehreka 2y ago> Useful from a business standpoint, yes. This business standpoint is the whole thing, I don’t see many people arguing otherwise. And the business standpoint is in fact quite revolutionary. Amazon can have a team of like 5 engineers maintaining VM images and as a result 500,000 other people don’t have to. And so you can host a “server” that’s only “on” when it’s in use, and usually end up paying less than $1/mo. In fact, you could likely run all of your side projects in lambda and if they’re “conventional web server” type things you could still end up paying less than $1/mo across all of them. Compare that to a $5/mo droplet for every side project (you probably don’t want to bunk multiple services into a $5 VM) and it definitely adds up before even considering updating the OS on those droplets.
- Sharlin 2y agoRunning PHP on a VM in a data center doesn’t cost you anything either while the VM isn’t doing stuff, and you still have something to ssh into and manage and investigate without layers of abstraction bolted on top. And PHP-on-httpd is pretty much one of the most newcomer-friendly straight-to-coding environments ever developed.
- sophacles 2y agoWhere can I get a VM in a data center that doesn't cost me anything?
- theendisney 2y agocost and convenience: Time is money. Whatever works for you is more important than 5 euro.
- rty32 2y agoLambda is pretty straightforward as well for those who know how to use it. You probably could do something marginally useful with lambda within 30 seconds as well.
- ArneBab 2y agoDon’t you have a virtual server? I’m pretty sure that my managed webserver runs on some virtual machine somewhere on a bigger server, and when it is not doing stuff, other tasks are running there and using the CPU and bandwidth. There is likely some fixed memory and disk space cost, but those are negligible with todays capacities.