David Wells

Full Stack Developer

Focused on UX/UI, Growth
& Product Development

The Serverless Revolution

Published on Edit this post

Imagine building an application, deploying it, and having it infinitely scale without managing servers.

Sounds like a pipe dream right?

Nope! It's a reality today with a "serverless" setup.

Going "serverless" is a new way of building and scaling your backend architecture without ever having to ever touch or manage a server.

#Real World Example

Let's pretend you are building an app.

  • The frontend is written in HTML/CSS and JavaScript.
  • The backend is JavaScript running on Node and you have a noSQL/SQL database

You are expecting to make billions within the first week and want this app to scale to handle all of your new users.

So you toss the frontend on a CDN, which scales nicely. Great!

What about your backend Node logic and database?

Tossing the node app on a single Linux box won't scale. Oh no!

Now you need to figure out how to replicate servers, do load balancing, configure autoscaling, containerize everything with docker... the list goes. You need some serious ninja devOps skills to be sitting pretty for all of your traffic.

Wouldn't it be nice if you didn't need to know devOps kung foo?

Instead, let's split up our backend application into tiny pieces:

Think of these pieces as micro micro services.

Each one is a just single function (or lambda). They do one thing and do that one thing very well.

aws-lambdaThese tinier functions are run individually via a distributed compute-on-demand service, like AWS Lambda.

Now you are asking:

'What's a "lambda" it sounds delicious'

  • You

You are right they delicious.

A lamdba is a function that you can call on demand without needing a server of your own to run the process.

Think about it like an on demand NodeJS instance that will run whatever function you want when you hit it's API endpoint or trigger it with a custom event.

POST /lamdba-api-gateway/my-api/run-my-custom-node-function // not real

Guess what! Now your backend will scale!

There is, obviously, a little more to it than this, but you get the idea. No more managing servers and AWS will scale out function calls for you.

You now have an app out of the box that will scale to millions of requests without you lifting a finger, AWS does the scaling of these lambda functions for you.

Additional bonus: if you app is a ghost town, you won't be paying an hourly rate for an EC2 instance. You only pay for invocations of the functions and machine time used per 100ms.

For startups/side projects this is a dream state.

Low cost, no maintenance, it just works.

I can't tell you how many EC2 or digital ocean boxes I have setup for "my next big thing" only to pay a monthly fee of $20 per server.

Those costs stack up quickly.

Going serverless should be far more cost efficient for you.

#Event driven computing

Lamdba revolves around the idea of an event driven model.

  • When X happens
  • -> trigger lambda function Y
  • -> then trigger Lambda function Z
  • -> then save data to my database
  • -> then database event log trigger Lambda function A
  • -> then send me a email
  • -> etc.

#C'mon is this REALLY "Serverless"

How can anything on the web truly be serverless?

Well... The "serverless" isn't without servers. You simply don't need to think about them.

Instead, focus on the real problems you are solving and where you provide value.

Focus on how to get more users, marketing, and the 20 million other things far more important to your business.

Stop worrying about "how are our server boxes doing? Do we need to update anything? Are we secure? What the hell is heart bleed? Will we scale of we get featured on Oprah? etc."

#Interested in learning more?

Here are some the resources I've been using to get up to speed AWS lambda.

Props to Austen Collins creator of the serverless framework for inspiring this post. I saw him demo the CLI today here in SF and I'm sold.