Understanding AWS Lambda - Beginner
Do you want to do some cool tasks like -
File processing: Use Amazon Simple Storage Service (Amazon S3) to trigger Lambda data processing in real time after an upload.
Stream processing: Use Lambda and Amazon Kinesis to process real-time streaming data for application activity tracking, transaction order processing, clickstream analysis, data cleansing, log filtering, indexing, social media analysis, Internet of Things (IoT) device data telemetry, and metering.
Web applications: Combine Lambda with other AWS services to build powerful web applications that automatically scale up and down and run in a highly available configuration across multiple data centers.
IoT backends: Build serverless backends using Lambda to handle web, mobile, IoT, and third-party API requests.
Mobile backends: Build backends using Lambda and Amazon API Gateway to authenticate and process API requests. Use AWS Amplify to easily integrate your backend with your iOS, Android, Web, and React Native frontends.
For all of the above AWS Lambda is one stop solution.
Understanding AWS Lambda -
AWS lambda is just a function like any other function that we wrote in Java/python or any other programming language. But the interesting part is, this function is provided by AWS cloud as a service. So, we don't need any server to host this function. So, you don't have to manage any servers because the managing part will be done by AWS.
So, you must be thinking now that what is the need for creating such a service. The answer to that is that there are other services like DynamoDB (Service for database management), S3 (Storing service), SNS (Simple Notification Service), SES, etc, which are used by organizations extensively if they opted for AWS. Using Lambda, you can automate data between these services easily. Some of the examples are already given above.
Also, Lambda is an event driven service. An event is a JSON-formatted document that contains data for a Lambda function to process. The Lambda runtime converts the event to an object and passes it to your function code. In simple words - the lambda function gets invoked by events to perform dedicated tasks. Different events can be configured to perform different tasks.
When you invoke a Lambda function, you can choose to invoke it synchronously or asynchronously. With synchronous invocation, you wait for the function to process the event and return a response. With asynchronous invocation, Lambda queues the event for processing and returns a response immediately. For asynchronous invocation, Lambda handles retries and can send invocation records to a destination.
Let's Create Lambda Function -
Step 1 - Log in to AWS console and search for AWS lambda.
Step 2 - Press on create function and fill basic configurations.
Step 3 - Your Lambda function will be created. You can test some basic print statements to run it.
Press Test to run lambda. Currently, we are not making use of any events so we will pass an empty JSON. Save it and press test.
Output :
I will be sharing some more concepts on lambda like monitoring Lambda, Using it as a bridge between different AWS services, Integrating it with our application backend, etc. in future articles.
Stay Tuned...
RESOURCES -
https://docs.aws.amazon.com/lambda/latest/dg/welcome.html
https://docs.aws.amazon.com/lambda/latest/dg/lambda-services.html
https://docs.aws.amazon.com/lambda/latest/dg/applications-usecases.html
https://docs.aws.amazon.com/lambda/latest/dg/lambda-invocation.html
Subscribe to my newsletter
Read articles from Vinayak Vats directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by