DEV Community

Cover image for Did someone say AWS Lambda?
Mursal Furqan
Mursal Furqan

Posted on

Did someone say AWS Lambda?

As much as we love programming, there is always a major road block, and that is, we can't find a way to scale the implementation in production. Well, good for us, AWS solved this for us 🎉
Yes, you heard that right. AWS solved this problem by introducing AWS Lambda. Now for those who are pythoneers, would be fimiliar with Lambda Functions, but what's cool about AWS Lambda, iss.... of wait! First, let's start our way.

What is AWS LAMBDA?

If someone say "We are going SERVERLESS"?

Just one word: "AWS LAMBDA"

AWS Lambda Screen

AWS Lambda is an Amazon Web Services (AWS) service that uses the Function as a Service (FaaS) architecture. That implies you, as a developer, are solely responsible for providing the function (i.e., code) that will be performed once the lambda function has completed. AWS handles everything else (servers, infrastructure, and scalability).

So no servers in Serverless?

Of course, there are servers, but you don't have to worry about providing and managing them as a developer. As a result, instead of tinkering with servers and worrying about whether they'll survive the next wave of consumers, you can focus on executing your business logic and addressing problems. Okay, however this appears to be rather costly. That's not the case! You only pay for the computing time you use using AWS Lambda.

What that means is that a lambda function can take up to 15 minutes to execute, but if your function only takes a second to execute, you will only be charged for that one second. The best thing is that you don't have to pay up front.

The free AWS Lambda tier offers ONE MILLION FREE REQUESTS PER MONTH. Yeah, not joking actually. In other words, you don't have to pay until your service becomes rather successful; one million requests per month is a substantial number. And when you exceed a million requests per month, you just pay $0.20 per million requests. (As an exercise for the reader, calculate how many requests you'd need to process until the cost of your serverless services exceeds the cost of a Starbucks cup of coffee.)

Cool! How do I do this?

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

Alt Text

.NET, Go, Java, Node.js, Python, Ruby - a little something for everyone.

Note: NO JQUERY Please!

Noted. How do I use my lambda function?

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

Alt Text

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 an insanely powerful paradigm, allowing you to build large processes and business logic out of serverless functions while reducing expenses to a minimum.

Discussion (1)

Collapse
web2033 profile image
Eugene Kopich

Serverless = "someone else is responsible for these servers going down" 😉