News for hackers. Stuff that matters.
Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by redleggedfrog on Thursday October 25, 2018 @11:20AM (#18301559)
"Error establishing a database connection"

That's more irony than I can handle this early.

Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by thanatos_dem on Thursday October 25, 2018 @11:33AM (#18301677)
I really hope that the website itself is running serverless on AWS, because that would be a great learning opportunity!

It's quite easy and common to wreck a database when you have it hooked up to serverless infrastructure. Depending on the DB, there can be a significant amount of overhead for each client connection. Postgres is particularly bad at this, since it spawns an entire process for each client that connects. This is why connection pooling is so important for applications.

Serverless is a different beast tho; every function is isolated, so having a client pool is much harder/impossible. If you get a flood of traffic, and your function interacts with a DB, you suddenly have a ton of non-multiplexed client connections, which is all it takes to bring many databases to their knees.

If this is a serverless website, I can't wait for the author's next article, describing this issue and how they addressed it. If it's not serverless... add a client pool.

Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by Aeolun on Thursday October 25, 2018 @11:47AM (#18301803)
We solved it by having an EC2 connection pool instance :P it just sits there and ensures all the lambdas don’t blow up the database.

Kind of defeats the point though :/

Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by ty_a on Thursday October 25, 2018 @01:45PM (#18302827)
You could run pgbouncer in a fargate container in ECS. Still serverless technically?
Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by tlarkworthy on Thursday October 25, 2018 @01:06PM (#18302447)
Google cloud functions are able to keep connections between invocations: https://cloud.google.com/functions/docs/bestpractices/networ...

It solves this exact problem and enables pooling (disclosure: I worked on related infrastructure)

Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by mrfredward on Thursday October 25, 2018 @01:51PM (#18302893)
As a lover of irony, I was disappointed to see the "maintenance page" source references this url:

"https://sinxloud.com/wp-admin/admin-ajax.php"

PHP running Wordpress. Sorry guys, it's not serverless.

Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by scarface74 on Thursday October 25, 2018 @03:00PM (#18303580)
On top of everything you said, if you put your database inside your VPC, your lambda function has to create a network interface inside the subnet. That increases the cold start time.

DynamoDB is a much better solution for serverless since it just uses a REST interface.

I’m a big fan of lambda but not for user facing API end points. It works well for eventually consistent event processing.

Setting up a Load Balancer and an Autoscaling group is not rocket science. Neither is automated patch management.

Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by benfrancis111 on Thursday October 25, 2018 @03:37PM (#18303899)
Aws serverless Aurora... API interface, fully mysql / postgres compatible, cheap to run - billed on a cpu minutes used basis, massively scalable, auto backup and its much faster than typical dedicated server setups. Amazon's best performing aws product ever they were saying.
Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by scarface74 on Thursday October 25, 2018 @04:43PM (#18304415)
Aurora is not the issue. The issue is a lack of connection pooling and the creation and destruction of ENIs when using Lambda with anything inside of a VPC.

If you want to do anything with user facing APIs, suck it up and spend $10 a month for two or three micro Linux instances set up in an autoscaling group behind a load balancer.

Elastic Beanstalk makes it dead simple.

Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by djhworld on Thursday October 25, 2018 @12:34PM (#18302204)
In Java you can create a shared connection pool for AWS lambda functions, e.g. using DI and initialising your injector statically when classes are loaded by the JVM

It relies on AWS using the same container/JVM for your invocations though which isn't guaranteed depending on what your load is.

Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by scarface74 on Thursday October 25, 2018 @04:50PM (#18304470)
Yes you technically can do the same with any language...configure your connection statically.
Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by paulmendoza on Thursday October 25, 2018 @11:42AM (#18301760)
I find most sites can just be setup as an S3 bucket with Cloudfront as the CDN. Any special logic can then be housed in some Lambda expressions behind API gateway. That probably would have prevented this outtage. But I haven’t read the article.
Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by cal5k on Thursday October 25, 2018 @11:44AM (#18301775)
Heck, even CloudFront is super easy to setup and works like a charm.
Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by nigealj on Thursday October 25, 2018 @11:53AM (#18301862)
So do you proxy your calls from S3 to a serverless service? And do you handle cross origin calls via CORS? Just curious because I've never used serverless before.
Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by benmanns on Thursday October 25, 2018 @11:59AM (#18301927)
You can use JavaScript on the frontend to call a Lambda function that you 100% control (including CORS, etc). You can use this to do things like authentication, authorization, and rate limiting, as well, versus just giving open access to an internal datastore.
Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by stephengillie on Thursday October 25, 2018 @12:07PM (#18301975)
CORS can be set on the S3 bucket - wide open is the default setting when you open the CORS properties in the S3 console.
Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by shroom on Thursday October 25, 2018 @11:23AM (#18301590)
The shoemaker's children go barefoot
Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by kohanz on Thursday October 25, 2018 @11:29AM (#18301643)
But it's "serverless", how could it go down?

(and I say this as someone that runs a web app built on the Serverless platform that I'm quite happy with - I just think it's a dumb name)

Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by jackhack on Thursday October 25, 2018 @11:48AM (#18301825)
financial divide by zero error or wallet capacity underflow.

Just speculating, but my guess is the bandwidth demand exhausted the available capacity and author wasn't willing to pay for more.

Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by kohanz on Thursday October 25, 2018 @02:08PM (#18303077)
My question of how it could go down was firmly tongue-in-cheek. My own serverless web app has gone down a few times during AWS outages, for example.
Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by mavdi on Thursday October 25, 2018 @11:25AM (#18301611)
Upvoted for the irony of it.
Re:Build a 100% Serverless Website with AWS in 7 Easy Steps by cheeze on Thursday October 25, 2018 @11:27AM (#18301629)
Man, that's hilarious