AWS Lambda & How It Works



What Is Lambda Function?

A lambda function is a small anonymous function. A lambda function can take any number of arguments, but can only have one expression.

What is AWS Lambda?

AWS Lambda is a compute service that lets you run code without provisioning or managing servers. AWS Lambda executes your code only when needed and scales automatically, from a few requests per day to thousands per second.  

AWS Lambda runs your code on a high-availability compute infrastructure and performs all of the administration of the compute resources, including server and operating system maintenance, capacity provisioning and automatic scaling, code monitoring and logging.

So simply we can say AWS lambda is a server-less compute service which upload your code & run a lambda functions. You don’t need to provision or manage any server Lambda will do it for you. Using Lambda, you only need to worry about your code.

Lambda function can run in two ways:

I : Event based - could be changes in S3 buckets or changes in tables of Dynamo DB

II: HTTP based - Using Amazon API

How Lambda Works:

1)   Upload your code to AWS lambda or write your own code in lambda code editor

2)   Setup your code to trigger from other AWS services, HTTP endpoints, or in app activity

3)   Lambda runs your code when it triggers, using only the compute node resources

4)   Just pay for the compute time you used


Languages Supports By AWS Lambda: AWS support below languages & more will be added in future.

-.Net Core 3.1, 2.1 (C#/PowerShell)

-Go 1.x

-JAVA 8 , 11

-Node.js 12.x , 10.x

-Python 3.8, 2.7, 3.6, 3.7

-Ruby 2.5 , 2.7

And Custom Runtime


What are the benifits of using lambda service in AWS :

Benefits:

1)   No servers to manage

2)   Continuous scaling

3)   Charge only when the function triggered

4)   Consistent Performance

Examples of Lambda Functions :

1)   Data Processing: Here is an example of images processing & real time stream processing.

Example of Use Lambda function in image processing:

Example of Use Lambda function in stream processing:

Example of use Lambda function in validation, filtering, sorting

2) Backend Processing:You can build server-less back-ends using AWS Lambda to handle web, mobile, Internet of Things (IoT), and 3rd party API requests.

Example of lambda function in web backend

Example of lambda function in mobile backend


Points To Remember:

-Like any services in AWS, Lambda needs to have a role associated with it that provide credentials with rights to other services.

-Lambda scales out automatically - each time your function is triggered, a new, separate instance of that function is started. There are limits, but these can be adjusted on request.

-AWS X-Ray helps developers analyze and debug production, distributed applications, such as those built using a microservices & serverless architectures.

-Each time a Lambda function is triggered, an isolated instance of that function is invoked. Multiple triggers result in multiple concurrent invocations, one for each time it is triggered.

-The exact ratio of cores to memory has varied over time for Lambda instances, however Lambda like EC2 and ECS supports hyper-threading on one or more virtual CPUs (if your code supports hyper-threading).




Post a Comment

0 Comments