What is AWS Lambda to someone like you who hates wasting money and losing sleep at night? Everything. Because AWS Lambda is a sweet piece of worry-free tech you pay for only when it’s actually doing its thing.
And its thing is running code. Your code.
If there’s no need for code to run, then Lambda goes silent and does nothing. It can lounge around by the pool on its tiny sliver of virtual real estate up there in the hybrid cloud services ecosystem without you footing the bill.
The “AWS” in AWS Lambda stands for “away with (traditional) servers.” No, no. It stands for Amazon Web Services. That’s Amazon, as in the massively big online retailer where vast numbers of people buy the desktops computers, laptops, tablets, and phones to access your websites and apps.
But the AWS might just as well stand for “away with traditional servers” because Lambda is a serverless hosting service. It allows you to cater to gazillions of visitors and users without having to buy or manage a bunch of physical servers and related infrastructure.
AWS Lambda vs Virtual Machines
AWS services from Amazon include an offering that amounts to an intermediate step between physical servers and Lambda. It’s EC2, and what EC2 is all about is giving you the ability to replace your traditional servers with virtual ones.
Once you do that, you avoid having to manage any physical servers, which can be a real pain in the byte if you have short-run, infrequent workloads and are strapped for money to buy traditional machines.
So, how does AWS Lambda fit into this? Let Amazon itself explain it:
“Amazon EC2 allows you to easily move existing applications to the cloud. With EC2 you are responsible for provisioning capacity, monitoring fleet health and performance, and designing for fault tolerance and scalability.
“AWS Lambda [on the other hand] makes it easy to execute code in response to events….Lambda performs all the operational and administrative activities on your behalf, including capacity provisioning, monitoring fleet health, applying security patches to the underlying compute resources, deploying your code, running a web service front end, and monitoring and logging your code. AWS Lambda provides easy scaling and high availability to your code without additional effort on your part.”
In other words, EC2 is the virtual hardware. AWS Lamba is the virtual software. EC2 management and maintenance falls to you. Lambda management and maintenance falls to Amazon.
Helpful Links for your AWS Lambda Research
Entrance’s primer on serverless architecture
Entrance’s post on how companies can use serverless to get apps off the ground faster and cheaper
n Reasons to Embrace Serverless Architecture
AWS Lambda vs Elastic Beanstalk
OK, now you’re probably wondering how AWS Lambda stacks up to app hosting services like Amazon’s Elastic Beanstalk.
In an AWS Lambda vs Elastic Beanstalk matchup, you should put your money on AWS Lambda. Actually, any money you put on AWS Lambda will be a lot less than what you plunk down on those other app hosting services.
Here’s why. Elastic Beanstalk makes you pay for uptime and availability. AWS Lambda does not.
Something else worth mentioning. AWS Lambda will let you slice your apps as granularly as you like. Can’t do that with Elastic Beanstalk. A Lambda function can be a single API endpoint, a collection of endpoints, or an entire app backend.
In addition, AWS Lambda works more easily with other AWS services. The icing on this cake is the fact that Amazon totally dominates the hybrid cloud services ecosystem. Pick AWS Lambda and you’re picking Number One.
AWS Lambda vs Azure Functions
Then there’s Microsoft’s Azure Functions, which is very similar to AWS Lambda.
Both run code in response to triggers defined by you. And both are totally compatible with other services within in their respective tribes—for example, AWS Lambda lets you easily set up triggers via Amazon’s API Gateway, DynamoDB, and S3 services, while Azure Functions lets you almost effortlessly configure your triggers with Azure Storage and Azure Event Hubs.
As for AWS Lambda vs Azure Functions differences, there are a few of note. One is the way they each handle short-term inactivity between events that trigger a code run. Another is that AWS Lambda allocates application resources to each function independently, whereas Azure Functions allocates them to whole groups.
The real tie-breaker here is that AWS Lambda is a creation of Amazon and its Web Services league of super-inventive minds. That’s why AWS is the leader in this space. So, in this cloud services ecosystem, AWS Lambda emerges as the clear victor.
Why AWS Lambda is a Must-Have
The bottom-line for you is that AWS Lambda lets you run app code on the cheap-and-easy.
What’s more, your code can be for almost any type of app—or, for that matter, almost any type of backend service.
And you can pretty much give your code zero thought once you upload it to AWS Lambda because AWS Lambda runs your code only when there’s a trigger event—and it’s up to you what that event will be.
For example, maybe the event is the placing of an online order. That’s something definitely requiring a code-directed response. Perhaps the shape of that response will be to have information about that transaction sent to your data warehouse where relevant analytics can then be generated. AWS Lambda will make sure the code it takes to accomplish all that runs, and that it runs correctly.
Or try this. Let’s say you make or sell online sensor-equipped refrigerators for the Internet of Things marketplace. It could be a long time before the buyer runs low enough on milk for that refrigerator to order more from the grocery store on his or her behalf.
But until then, the sensors probably won’t be relaying information about the milk situation. AWS Lambda knows this. As a result, it will run the code that causes a milk order to be placed only if and when the sensors call attention to that low dairy drink situation.
One last example: traffic updates. Your user who’s getting ready to head off for work wants to find out about road conditions. So he or she clicks the link at your traffic app. Your app makes a REST API call to the endpoint on the other side of the gateway. Lambda instantly shifts into gear and hits the gas pedal by running code to obtain local traffic info and then sending that news back across the gateway to the waiting user.
AWS Lambda Pricing
Again, saving you money is a gigantic piece of the idea behind running code only when pre-defined triggering events take place. This is why AWS Lambda has you paying for just the resources you actually consume.
Now, what is AWS Lambda pricing based on? It’s based on the volume of triggering events per 100-millisecond unit as well as memory allocation.Amazon offers a couple of price scenarios to show you how this works in real life.
Scenario 1: You give your app function 512MB of memory. This function fires 3 million times a month (about 1 per second). Every time it fires, the function runs for 1 full second. Your cost would be just under $19 for a 30-day billing cycle.
Not too shabby.
Scenario 2: You allocate only 128MB of memory to your function, but now it runs 30 million times a month (about 10 per second). As before, the run time is 1 second. Your cost in this instance would be less than $12 a month.
Confusing, right? So it’s a good thing Amazon offers a free calculator to figure out your monthly charges based on your exact situation. Access it at http://calculator.s3.amazonaws.com/index.html
Now that you know what is AWS Lambda, your next moves should be to sign up for an AWS account, follow the step-by-step tutorials, and use the AWS Management Console to put your code in place.
After that, you can let a big, bright smile completely take over your face—a smile that comes from enjoying the silence of the Lambda until the moments its help is actually needed. Until then, enjoy the sense of freedom that comes from not being weighed down by worries and costs.