Tue Jul 09 2019
Utility of AWS Lambda
AWS Lambda is Amazon’s serverless compute service as a part of the Amazon Web Services. It's a service for running code in response to events, such as changes to data in an Amazon S3 bucket and Amazon DynamoDB tables, or computing as services to run your code in response to HTTP requests using Amazon API gateway or API calls made by using AWS SDKs. AWS Lambda manages the computer fleet that handles memory, CPU, networking and other resources in exchange for flexibility, in other words, you don't need to modify your instance in any way while hosted on AWS Lambda. It can run your code without provisioning any Infrastructure or servers.
It also works on instances by launching or terminating them, checking their health, helps in auto-scaling, updates, etc.
It was introduced in November 2014. AWS Lambda currently supports Node.js, Java and Python computer languages.
AWS Lambda features
Lambda allows the use of serverless and microservices programming architectures to support ‘Function as a Service’ (FaaS), allowing developers to focus on writing code. You can run your code on it without having to manage servers or even containers. It’ll automatically scale depending on how much work you feed into it. Here are some other features -
You can use the internal source code editor that is available online directly in the Lambda Console. Essentially, the Lambda function code runs on Amazon Linux, and as such can use any tools included with the OS. Lambda functions can be bundled with other deployment artifacts such as libraries and even Linux executable files. Just, you need to upload your code as a zip or jar archive, then AWS Lambda does the rest.
Access to other AWS services, such as DynamoDB or CloudWatch is controlled through IAM roles. This prevents unnecessary data exposure to certain Lambda functions and lowers the attack surface of the microservice in the event of a security breach.
Lambda allows You to choose the amount of memory you want to allocate to your functions and AWS Lambda allocates proportional CPU power, network bandwidth, and disk I/O.
AWS Lambda automatically scales the infrastructure depending on the number of requests, without any additional configuration from your side. It is no longer necessary to size your deployment’s capacity for traffic peaks.
Event Driven Model
AWS Lambda functions can be triggered by different events, including events from AWS services such as S3, DynamoDB, CodeCommit, CloudWatch, and AWS IoT. Lambda also allows functions to be triggered as a response to inbound HTTP requests, as a response to inbound messages (SNS, Kinesis), or by a scheduled event. The AWS mobile SDK conveniently supports invocation of Lambda functions from mobile apps.
You can use AWS Lambda to create new back-end services for your applications that are triggered on-demand using the Lambda API or custom API endpoints built using Amazon API Gateway. By using Lambda to process custom events instead of servicing these on the client, you can avoid client platform variations, reduce battery drain, and enable easier updates.
By default tolerance
Lambda has built-in fault tolerance. AWS Lambda maintains compute capacity across multiple Availability Zones in each region to help protect your code against individual machine or data center facility failures. Both AWS Lambda and the functions running on the service provide predictable and reliable operational performance. AWS Lambda is designed to provide high availability for both the service itself and for the functions it operates. There are no maintenance windows or scheduled downtimes.
With AWS Lambda you pay only for the requests served and the compute time required to run your code. Billing is metered in increments of 100 milliseconds, making it cost-effective and easy to scale automatically from a few requests per day to thousands per second.
API Gateway is the portal to your microcosm within AWS. It’ll connect to many of the cloud services directly, but when you need flexibility, Lambda is your go-to. It’s where you put custom code to process requests that come in through the API Gateway. Use a Lambda when you need to access several services or do custom processing.
How does it work?
Upload your code to AWS Lambda or write code in Lambda build-in code editor.
Next, set up your code to trigger from other AWS services, HTTP end-points, or in-app activity.
Lambda runs code only when triggered, using only the computing resources needed.
Then, just pay for the compute time that you use.
Utilities of AWS Lambda
By combining AWS Lambda with other AWS services, developers can build powerful web apps that automatically scale up and down and run in a highly available configuration across multiple data centers – with zero administrative effort required for scalability, back-ups or multi-datacenter redundancy.
To extract, load
You can use AWS Lambda to perform data validation, filtering, sorting, or other transformations for every data change in a DynamoDB table and load the transformed data to another data store.
You can use Amazon S3 to trigger AWS Lambda to process data immediately after an upload. For instance, you can use Lambda to thumbnail images, transcode videos, index files, process logs, validate content, and aggregate and filter data in real-time.
You can use AWS Lambda to process real-time streaming data for application activity tracking, transaction order processing, clickstream analysis, data cleansing, metrics generation, log filtering, indexing, social media analysis, and IoT device data telemetry and metering.
To create backends
You can build serverless backends using AWS Lambda to handle web, mobile, Internet of Things (IoT), and 3rd party API requests. You can also build backends using AWS Lambda and Amazon API Gateway to authenticate and process API requests. Lambda makes it easy to create rich, personalized app experiences.
To execute code
You can use AWS Lambda to execute code in response to triggers such as changes in data, shifts in system state, or actions by users. Lambda can be directly triggered by AWS services such as S3, DynamoDB, Kinesis, SNS, and CloudWatch, or it can be orchestrated into workflows by AWS Step Functions. This allows you to build a variety of real-time serverless data processing systems.