Here we have a AWS lambda and serverless ecosystem with two
lambda functions working in coordination of a step function.
One of the questions that many people have when they're first exposed to lambda is,
why do we care about this, what's the point of it?
Well, first up, let's start with automatic scaling.
Serverless platforms will automatically scale the number of function
instances based on the demand.
So this eliminates the need for manual intervention to provision or
deprovision a server.
So this is a huge one in terms of just putting some code into the cloud and
letting it run.
This auto scaling capability then allows you to handle many different types
of loads seamlessly from.
Let's say, a few requests per second to thousands of requests per second, and
you don't have to change any of the code.
In terms of cost efficiency as well, so you have pay as you go pricing and
you only pay for the amount of resources that are consumed and not for
a pre allocated or idle server capacity.
And this pricing model can lead to significant cost savings because it's
event based.
So if we take a look as well on the language, if you're able to leverage one
of the fastest languages in the world, which is Rust.
It has up to 70 times less memory associated
with the invocation than Python.
So you could at bare minimum think about some of
the same code running with 70 times less pricing.
So, that's another thing to consider is the choice of language,
does it help you out as well?
And then in terms of operational management,
it's a serverless environment where the cloud provider takes care
of the server provisioning, maintenance, patching and capacity planning.
And so this approach would free developers from the need to focus on any
kind of infrastructure management.
So this is kind of a realistic type of scenario here.
If you orchestrated two different lambda functions, let's say that it's in Rust or
Python, it doesn't really matter.
And you have a payload at the very beginning that would go into the step
function.
The next thing that would occur is that that Rust code would then process it and
then return back another payload.
So this is typically what you would do is you'd chain together these lambdas.
Now, maybe the next function, just for simplicity's sake,
would divide a payload so it would look for a key total and then divide by two,
and then it would return back a calculation.
So you can chain together these pieces of code and
they'll just sit there doing nothing.
You're not charged until they're actually invoked, and
also it can be event based as well.
So it can respond to, let's say, a change in a s3 bucket or
a change in SQS or some other change.
And this is really the beauty of using a serverless model is that if you do
it correctly, you're going to save a tremendous amount of revenue.
And also from an operational standpoint, it's much more simple.