DEV Community

Cover image for WTF is AWS Lambda?
Tomasz Łakomy
Tomasz Łakomy

Posted on • Updated on

WTF is AWS Lambda?

Before we start #1 - I'm working on, a brand new way of monitoring serverless apps 🚀. Check it our if you're tired of switching between 50 CloudWatch tabs when debugging a production incident.

Before we start #2

If you don't feel like reading and prefer to watch a bunch of quick (less than 3 minutes) videos - this blog series is based on a 💰free 💰 video collection I've published recently, check it out here: Learn AWS Lambda from scratch.

WTF is AWS Lambda?

When someone says that:

Yeah, we're going serverless with AWS

They probably mean AWS Lambda

AWS Lambda Homepage

I'm not an expert but this is quite a lot of text for a landing page tbh

AWS Lambda is an Amazon Web Services service which operates in a Function as a Service (FaaS for short) model. What that means is that you, as a developer, are only responsible to provide the function (that is - the code) that needs to be executed once the lambda function runs. Everything else (servers, infrastructure, scaling) is taken care of by AWS.

This is what serverless means.

Of course, there ARE servers, but you, as a developer, you don't have to care about provisioning and maintaining servers. Which means that you get to focus on implementing your business logic and solving your problems, instead of having to tinker with servers and worry whether they'll survive the next wave of customers.

Okay, but this sounds expensive

It's not! With AWS Lambda you only pay for the compute time you consume.

What that means is that a lambda function can take up to 15 minutes to execute, but if your function takes only a second to run you will only pay for this one single second of execution time.

The best part is - you don't start paying right away.

AWS Lambda free tier usage includes ONE FREAKING MILLION free requests per month.

In other words - you only start paying one your service gets rather popular, one million request per month is pretty significant.

Once you go above a million requests per month, you pay only $0.20 per million requests. (An exercise for the reader: calculate how many requests you'd need to handle before the cost of your serverless functions becomes more than a cup of coffee from Starbucks).

What can I use to create my lambda functions?

Excellent question.

There are a number of programming languages supported in AWS Lambda:

A list of programming languages supported by AWS Lambda

.NET, Go, Java, Node.js, Python, Ruby - a little something for everyone (no jQuery though).

How do I trigger a lambda function?

A lambda function can be triggered by quite a lot of sources.

A list of AWS Lambda triggers

Honorable mentions:

  • AWS Gateway can trigger your lambda function by an HTTP request (useful when you want to create an API
  • AWS IoT - you can literally have a "push to prod" button on your desk
  • AWS S3 - a lambda function can be triggered by uploading a file to an S3 bucket (if you don't know what a bucket is, check this post out.)
  • AWS DynamoDB - you can trigger a lambda function by for instance adding an item to your DynamoDB table

It's a ridiculously powerful paradigm, allowing you to compose major workflows and business logic out of serverless functions, while keeping your costs extremely low.

Top comments (6)

felipperegazio profile image
Felippe Regazio • Edited

Pretty cool. Im thinking about trying AWS Lambda on a project, and i have some simple questions:

  1. Can i configure a good server side cache?
  2. Things like language modules, Apache(?) modules are included as a config?
  3. It supports large and complex LAMP projects?

Thank you for your post and your time Tomasz.
Sorry if my comment was too silly.

andrzejwp profile image

AWS Lambda is meant to execute a task and then shutdown, it's not something that keeps running endlessly and is always ready to serve your user's requests.

So - think static website generators (GatsbyJs, NextJS, etc.) not LAMP. You can easily use Lambda to generate a set of static HTML files and then publish that to S3. In fact AWS has a whole tutorial on that

felipperegazio profile image
Felippe Regazio

Oh yap, got it! Thank you for your reply, @andrzejwp !

daksh profile image

no jQuery though?? Why should jQuery be supported? isn't that just a DOM library?

byrro profile image
Renato Byrro

Yes, the comment about jQuery is misplaced in this article. There's no point in running jQuery in the backend. If you do need to traverse HTML DOM in the backend, all of the languages already supported will have libraries for that. jQuery is much more than just traversing the DOM and only makes sense in the frontend...

tlakomy profile image
Tomasz Łakomy

It’s a joke, don’t worry 😅