
Build a 100% Serverless Website with AWS in 7 Easy Steps - sakimjan8
https://sinxloud.com/how-create-build-serverless-website-steps/
======
redleggedfrog
"Error establishing a database connection"

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

~~~
thanatos_dem
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.

~~~
Aeolun
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 :/

~~~
ty_a
You could run pgbouncer in a fargate container in ECS. Still serverless
technically?

------
jacob019
I cringe every time I read serverless, what exactly is that supposed to
convey? That the code is so ephemeral that it doesn't even exist, or does the
code execute on a higher plane of existence without the need for lowly
hardware and dirty power?

Furthermore, I fail to see what real world problems this architecture solves.
It seems to offer rapid horizontal scaling at the cost of complexity,
performance, and vendor lock-in.

~~~
jkingsbery
(Disclaimer: I am an Amazon employee, but my opinions are my own. I don't work
in the AWS organization, so my knowledge of AWS services isn't substantially
different than other engineers outside of Amazon.)

There obviously are servers, "serverless" just implies you don't own them.

There's a few problems that using serverless solves:

1\. It's great for low volume sites or services. You don't need to rent
hardware that runs the whole month if you only get pinged a few times per day.

2\. It reduces operational burden. A whole class of problem goes away -
patching operating systems and application servers.

3\. It provides an abstraction layer for processing events. Events could be
HTTP requests to a site, data coming in from an IoT device, that a new file
was uploaded to S3, etc.

Performance isn't that different from using EC2 (or the non-AWS equivalents),
other than cold start times, and choice of language platform can help mitigate
that.

In terms of complexity, for the project work I've done the complexity isn't
different than running something in any other application server.

Cloud providers other than AWS have a serverless offering, and there are
frameworks out there for abstracting the differences, so tooling support
doesn't have to come with lock-in. In addition, a well-architected serverless
application has a pretty small layer interfacing with the serverless
framework, so the code lock in is negligible.

~~~
esotericn
#1 - A VPS that you can run multiple services on is 5 quid a month.

I spent more than that on a single train in to the city today.

Or you can just run from a residential connection for effectively free if your
service is _that_ small.

#2 - "Serverless" paradigms change often enough that it's essentially another
form of patching.

It's also obviously not true, any system you write code on needs to be patched
because it has auth to this system.

#3 seems to be buzzwords with no substance?

As far as I can tell, the only "problem" that "serverless" (i.e. Our Servers)
solves is Amazon not monetizing everything ever.

~~~
jnty
Quoting the price of a VPS totally misses the point - the cost is in finding
one, setting it up with an environment somehow, monitoring it, making sure it
stays patched and current over years and years...

While you're busy figuring out what monitoring solution to use on your VPS to
monitor the running all for the sake of a little Python script, I've already
set up a lambda function and maybe set a cloudwatch alarm to look after it and
can move on to the next thing and leave it running indefinitely. Depending on
the usecase I might not even pay a penny during that time, either.

I swear 90% of the hate for serverless purely stems from irritation at the
name.

~~~
isomorph
Hi - I couldn't find a way to contact you and was unable to reply in situ for
some reason. Could you please say more about why you felt I had gratuitously
editorialised the title to my latest submission? (
[https://news.ycombinator.com/submitted?id=isomorph](https://news.ycombinator.com/submitted?id=isomorph)
)

I have checked the definition of the word "editorialise: To present an opinion
in the guise of an objective report." \- I did not express any opinion in the
title - I simply added context for those who don't know about the so-called
"contaminated blood scandal" in the UK. Namely the three-letter detail I added
was "HIV" i.e. that the UK's government-run National Health Service infected
patients as young as 8 years old with HIV.

This change was not gratuitous as it added essential context to the story.

I have checked the Hacker News guidelines and since the article dispels myths
people have about health systems, I felt it was pertinent.

------
ryanmccullagh
Sounds cool in theory, but my small experience with a past company's
serverless API is that it made impossible to debug. It was like deploying to a
black box. There's no way to hit the API locally, etc.

~~~
elliottlan
Have you seen this npm package?

[https://www.npmjs.com/package/serverless-
offline](https://www.npmjs.com/package/serverless-offline)

I have no idea if this exists for other languages but its what lets me develop
and test my functions locally before deploying them to stage/live.

Edit: they have some good examples -
[https://github.com/serverless/examples/tree/master/aws-
node-...](https://github.com/serverless/examples/tree/master/aws-node-rest-
api-with-dynamodb-and-offline)

------
ironchef
They didn't say "running it" ... just building it ...

------
jaiks
'Error establishing a database connection'

neat :)

------
brtknr
Upvoted the main article to reveal to the world why I'm not convinced on this
serverless hype.

------
anonu
I've had a great time learning AWS Serverless. I run a financial data website
where much of the data is "pre-computed" overnight and stored in a special
hierarchy on S3. All other computations are pushed off to client-side
JavaScript.

S3-> CloudFront CDN with Amazon API Gateway normalizing access to various
endpoints (Lambda, DynamoDB). This is a great way to go and scales
beautifully.

------
fugazithehaxoar
This is interesting to me because my company is right in the middle of the
serverless movement. I know and work with over a dozen large companies that
have moved their fairly standard micoservice-oriented architecture over to
100% serverless. Lots of people in the ops world still think this is some kind
of marketing nonsense or black magic though.

Long story short, when engineering teams move to serverless, they get huge
scalability benefits and essentially "squashing their stack" making team
engineering velocity way faster than when they were using EC2/Kubernetes/VMs.

Imagine 10 years ago, being a LAMP stack developer. One day, you find a
hosting platform lat allows you to be a much more fast/effective LAMP
developer while only needing to work with M+P. This is the core benefit of
serverless.

Yes, there are servers under the hood somewhere at an AWS datacenter. Yes,
infrastructure still gets patched, updated, etc. Serverless is all about
letting engineering team focus on building the application and making the
infrastructure "not my problem".

~~~
closeparen
IMO Google Cloud correctly describes its serverless platform as a place to
host little one-off utilities in your infrastructure that don’t need to
consume resources all the time. (Employee onboarding, deployment plumbing,
etc). Not as an appropriate way to build your entire product.

If you’re using it that way, it’s really no different from Elastic Beanstalk /
Heroku / ye olde shared PHP hosting. Which is fine, but not some kind of
revolution. Just the pendulum swinging back.

------
deadcast
I guess having a "server" would have prevented the down time. ;)

------
anoonmoose
So, uh, was this hosted on AWS? Slash, anyone got a cache?

~~~
sriehl
Here's an archive of it [https://archive.is/zpDgO](https://archive.is/zpDgO)

~~~
MaxBarraclough
Thanks. Think those guys use a server?

------
DonHopkins
Step 1: Redefine AWS as "not a server"....

Step 2: Get a database server that works...

Step 3: Congratulations: You've just served yourself!

------
meirelles
IMHO serverless is amazing if you clearly understand the bottlenecks and still
see real benefits from it. Otherwise, you may exchange one problem for another
(probably even worse).

------
garganzol
Serverless is the awful term. Just like a websiteless website.

------
stunt
I think AWS is pushing more unofficial content online to attract developers. I
just see an increase in HN recently!!

------
EGreg
Real serverless uses WebRTC and peer to peer connections. (Hi WebTorrent.
Thanks for visiting Dat.)

------
mananvaghasiya
A lesson to be learned here

------
dubyabee2
That isn't completely test? "Easy" (thumbs up)

------
thomas
Database connection failure. Not ready for HN scale I guess

------
philliphaydon
Seems much easier to setup an asp.net core lambda app.

------
0z3r07
nice, easiest how-to ever!

