Explaning AWS Lambda Function

AWS Lambda is a computing 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. You pay only for the compute time you consume - there is no charge when your code is not running.

Executes AWS Lambda Code only when triggered by AWS services under scenarios such as −

  • The user uploads files to the S3 bucket
  • http get/post endpoint URL is hit
  • data is added/updated/deleted in dynamo dB tables
  • push notification
  • data streams collection
  • hosting of website
  • email sending
  • mobile app, etc.

AWS Lambda gives you the infrastructure to upload your code. It takes care of maintaining the code and triggers the code whenever the required event happens. It allows you to choose the memory and the timeout required for the code.

AWS Lambda can also execute parallel requests as per the event triggers.

Use Cases of AWS Lambda

AWS Lambda is a computing service mainly used to run background processes. It can trigger when used with other AWS services. The list of AWS services where we can use AWS Lambda is given below −

S3 Object and AWS Lambda

Amazon S3 passes the event details to AWS Lambda when there is any file upload in S3. The details of the file upload, deletion of a file, or moving of a file are passed to the AWS Lambda. The code in AWS Lambda can take the necessary steps when it receives the event details. For Example, creating a thumbnail of the image inserted into S3.

DynamoDB and AWS Lambda

DynamoDB can trigger AWS Lambda when there is data added, updated and deleted in the table. AWS Lambda event has all the details of the AWS DynamoDB table about the insert /update or delete.

API Gateway and AWS Lambda

API Gateway can trigger AWS Lambda on GET/POST methods. We can create a form and share details with the API Gateway endpoint and use it with AWS Lambda for further processing, such as making an entry of the data in the DynamoDB table.

SNS and AWS Lambda

SNS is used for push notifications, sending SMS, etc. We can trigger AWS lambda when there is any push notification happening in SNS. We can also send an SMS to the phone number from AWS Lambda when it receives the trigger.

Scheduled Events and AWS Lambda

Scheduled Events can be used for cron jobs. It can trigger AWS Lambda to carry out the task at a regular time pattern.

CloudTrail and AWS Lambda

CloudTrail can be helpful in monitoring the logs on the account. We can use AWS Lambda to further process the CloudTrail logs.

Kinesis and AWS Lambda

Kinesis is used to capture/store real-time tracking data coming from website clicks, logs, and social media feeds, and a trigger to AWS Lambda can do additional processing on these logs.

CloudFront and Lambda

CloudFront is a content delivery network where you can host your website, and Lambda@Edge can be used to process the headers coming from viewer request, origin requests, origin response and viewer response. The headers modification includes tasks such as modifying cookie data, URL rewrite, used for AB testing to change the response sent to the user back, adding extra header info for security purposes etc.


Similar Articles