0% found this document useful (0 votes)
8 views39 pages

AWS - Lambda

AWS Lambda Functions are a serverless compute service that allows users to run code without managing infrastructure, triggered by events. They facilitate communication between AWS services, automatically scale, and optimize costs based on compute time used. Practical applications include file and stream processing, web applications, and IoT backends, with a focus on ease of use for developers.

Uploaded by

NandaShivani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views39 pages

AWS - Lambda

AWS Lambda Functions are a serverless compute service that allows users to run code without managing infrastructure, triggered by events. They facilitate communication between AWS services, automatically scale, and optimize costs based on compute time used. Practical applications include file and stream processing, web applications, and IoT backends, with a focus on ease of use for developers.

Uploaded by

NandaShivani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 39

AWS

LAMBDA
FUNCTIONS
Serverless Compute Services
AWS LAMBDA FUNCTIONS
 Frequently Used Service

 A perfect fit for mini tasks that are repeated frequently

 Serverless Compute Service

 run code without provisioning or managing infrastructure (h/w,

servers, OS)

 Event-driven Service

 event-driven architecture runs code in response to events

 Automatically Triggered


AWS LAMBDA FUNCTIONS
 Orchestrator of AWS Services

 facilitates communication between multiple decoupled AWS services

 Auto scaled AWS Service

 automatically responds to code execution requests at any scale

 Cost saving AWS Service

 pay only for the compute time used

 Code Optimizer AWS Service

 code execution time and performance are optimized with the right

function memory size


LAMBDA FUNCTIONS – A PRACTICAL SCENARIO

 Take a photo and upload it with a mobile device

 Uploaded photo is stored in a Amazon S3 bucket

 Lambda function is triggered once the photo is uploaded to S3

 AWS Lambda consumes photo and implements code to apply filter to the

image
AWS LAMBDA APPLICATIONS
• File processing:
• Amazon Simple Storage Service (Amazon S3) can trigger
Lambda data processing in real time after an upload

• Stream processing:

• Lambda and Amazon Kinesis together can 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)
AWS LAMBDA APPLICATIONS
• Web applications

• Lambda combined with other AWS services can 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 with your iOS,
LAMBDA FUNCTIONS ANATOMY
 Handler( ) Function

 function to be executed upon invocation

 requires two parameters : event and context

 Event Object

 data sent during lambda function invocation

 Context Object

 data generated by the environment

 contains information about underlying infrastructure and execution environment

 allowed runtime, allowed memory space


LAMBDA FUNCTIONS ANATOMY
import json
def lambdaHandler(event, context):
return{
‘status code’ : 200,
‘body’ : json.dumps(“ ALL is WELL ”)
• return statement above represents

• The code body to be executed when the lambda function is triggered

• Note:

• Playground for any AWS Lambda beginner

• https://console.aws.amazon.com/lambda/home?/region=us-east-1#/b
LAMBDA FUNCTION – SCENARIO 1
 Implement a Lambda Function to return the Capitalized version of the
text
1. Login to amazon console with AWS account credentials
2. Select the closest region as per geographical proximity to the server
facilitation
1. Locate for Region drop-down at the top-right corner
2. Choose Asia Pacific (Mumbai) ap-south-1
Note: Only after the region selection proceed any further
3. Locate for Lambda in the Services search bar
4. Now we should land on the Lambda Dashboard
5. Click create function tab
6. Choose the function template type as author from scratch( the default type
) in contrast to the other two choices like
1. Use a blueprint - Build a Lambda application from sample code and
configuration presets for common use cases
LAMBDA FUNCTION – SCENARIO 1
7. Then specify the following information
1. Function name : give a name that describes the purpose of the function to be
implemented ( say capitalizeText)
2. Runtime info : choose the language to use to write your function
Note that the console code editor supports only Node.js, Python, and Ruby
8. Then click on the tab create function
9. Go to Lambda function dashboard and click on the function name capitalizeText
10. Locate the Code source editor and click on the Test tab in blue with a drop down
11. Select configure a test event
12. Give an event name
13. In the Event JSON specify the event and the action as key:value pairs
{
"key1": "value1",
"key2": "value2",
"key3": "value3“
}
LAMBDA FUNCTION – SCENARIO 1
LAMBDA FUNCTION – SCENARIO 1
LAMBDA FUNCTION – SCENARIO 1
LAMBDA FUNCTION – SCENARIO 2
LAMBDA FUNCTION – SCENARIO 2
LAMBDA FUNCTION – SCENARIO 2
LAMBDA FUNCTION – SCENARIO 2
LAMBDA FUNCTION – SCENARIO 2

You might also like