Understanding Serverless Architecture with AWS Lambda
AWS Lambda is a compute service that provides serverless compute functions that run in response to events or triggers. When an event or trigger is detected, a lambda function is spun up in a secure and isolated runtime environment, which is called execution environment.
Traditionally applications run on servers , these servers can be physical (or bare metal). They can also be virtual environments that run on top of physical servers. However you must purchase and provision all these type of servers and you must also manage their capacity.
In contrast, you can run your code on AWS Lambda without needing to pre-allocate servers , with lambda you only need to provide the code and define a triger. The lambda function can run when it is needed, whether it is once per week or hundreds of times per second, you only pay for what you use.
⚙️ Lambda In Use
The image above demonstrates how to trigger a lambda function when a file is uploaded to an S3 bucket. The file will be loaded into an Amazon Dynamo DB table then the dat will be available for you to view on a dashboard page that retrieves the data directly from DynamboDB. This is a typical example of a serverless solution that automatically scales when it is used. It also incurs little cost when it is in use and no cost is incurred when it is idle. When you use Lambda, you are responsible only for your code, which can make it easier to optimize for operational efficiency and low operational overhead. Lambda manages the compute fleet, which offers a balance ofmemory, CPU, network, and other resources to run your code. Because Lambda manages these resources, you can’t log in to compute instances or customize the operating system on the provided runtimes. Lambda performs operational and administrative activities on your behalf, including managing capacity, monitoring, and logging your Lambdafunctions.
Lambda can be used for virtually any application or backend that requires compute and that runs in under 15 minutes. Common use cases are web backends, Internet of Things (IoT) backends, mobile backends, file or data processing, stream or message processing, and more.
Lambda is a good choice for use cases where the requirements include reducing operational overhead, optimizing for cost, or optimizing for performance efficiency. Lambda works well for these use cases because it’s a managed service and you only pay for what you use. There are no idling resources when working with AWS Lambda, which means that each Lambda function is highly performant and cost efficient.