How does AWS Lambda work ! ?
Published: 2023-05-01 05:11:04

Today we are going to learn about the concept of AWS Lambda and how does it's works.


   


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qw903bamit876kbudmzv.jpg)AWS Lambda and How does AWS Lambda work

We will see overview,  Concepts, Examples, Main Features and Best Practices of AWS Lambda. And of course, after that we will walkthrough AWS Console of AWS Lambda, create functions, run and test functions, see configurations and so on.



**What is AWS Lamobda?**

AWS lambda is the most popular serverless compute platform that is using millions of customer and running billions of invocations all over the world.
AWS Lambda is a compute service that Runs code without thinking any servers or underlying services. It is a serverless function that you only responsible for your actual code.

If we look at the Wikipedia definition;


AWS Lambda provide to create functions,

self-contained applications written in one of the supported languages and runtimes,
and upload code to AWS Lambda,
and executes those functions in an efficient way without thinking scalability and availability issues.
For that reason, you don’t need to worry about which AWS resources to launch, or how will you manage them. Instead of that, you need to put the code on Lambda, and it runs. AWS Lambda supports different Runtimes like Node.js, Python, Java, Go, Ruby, .NET and so on.

AWS Lambda is designed for event-driven architecture so examples use cases such as image or object uploads to Amazon S3, updates to DynamoDB tables, responding to website clicks, and so on.

So we can say that AWS Lambda is a serverless, event-driven compute service that lets you run code for virtually any type of application or backend service without provisioning or managing servers.

We can trigger Lambda from over 200 AWS services so that means Lambda has natural integrations with aws resources and also able to integrate saas applications.


**How does AWS Lambda work?**
We said that So AWS Lambda fits into the event-driven architectures. As you can see the image below, AWS Lambda triggers by event and executes the function code.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1d2bhypj0qv9fvtvqm6h.jpg)
But How does AWS Lambda work? Each Lambda function runs in its own container. You can think every lambda function as a standalone docker containers. When a function is created, Lambda packages it into a new container and then executes that container on a multi-region cloud clusters of servers managed by AWS.

Before the functions start running, each function’s container is allocated its necessary RAM and CPU capacity that parameters are configurable in AWS Lambda.

When the functions finish running, there is a calculation; the allocated RAM and the function execution time is multiplied and calculated charged cost to the customer. So that means AWS users charged based on the allocated memory and the amount of execution time the function finished.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3f1trdydb3dwn56r84xj.jpg) Using AWS Lambda can save you time on operational tasks because the service is fully managed. When there is no infrastructure to maintain, you can spend more time on application code and your actual business logics; that means it giving up the flexibility about to your infrastructure.