The evolution or timeline of Lambda looks something like this:
On-Prem DataCenter –> IAAS –> PaaS –> containerization/Docker –> Serverless
Lambda is a compute service where you can upload your code and create a Lambda function. AWS Lambda takes care of provisioning and managing the servers that you use to run the code. You do not have to worry about operating systems, patching, scaling etc.
It is essentially described as an event-driven compute service where AWS Lambda runs your code in response to events. These events could be changes to the data in an Amazon S3 bucket or an Amazon Dynamo DB table.
Lambda events can trigger other Lambda events or call other AWS services like SQS or SNS.
The Lambda runtime is fully managed by AWS. Once a function is uploaded and configured, Lambda is responsible for managing the resources required to run the code.
Developers are free from the traditional overhead of configuring and maintaining server instances.
Lambda will immediately scale to meet spikes in demand.
Lambda is cost-effective as you only pay for the computational resources used. This is, of course, true for other AWS compute services, but the cost model for Lambda is more granular than EC2 for example, with resources being charged per 100 milliseconds.
Lambdas event-driven model means you can integrate nicely with a range of AWS services, but still ensure loose coupling.
It’s very low cost. The first 1 million requests are free and you have to pay 0.20 per 1 million requests thereafter!!
So far we have seen that certain applications can be broken down into one or more simple nuggets of code called as functions and uploaded to AWS Lambda for execution. Lambda then takes care of provisioning the necessary resources to run your function along with other management activities such as auto-scaling of your functions, their availability, and so on. So what exactly are we supposed to do in all this? A developer basically has three tasks to perform when it comes to working with Lambda--writing the code, packaging it for deployment, and finally monitoring its execution and fine-tuning.
In this section, we are going to explore the different components that actually make up a Lambda function by understanding what AWS calls as a programming model or a programming pattern. Currently, AWS officially supports Node.js, Java, Python, and C# as the programming languages for writing Lambda functions, with each language following a generic programming pattern that comprises of the following concepts.