AWS Lambda
AWS Lambda
AWS Lambda
Lambda
Solita.
AWS Lambda
Contents
1. AWS Lambda
2. Other AWS tools used in this exercise
3. Accounts & Roles
4. AWS Web Console
5. Exercise part 1: Analysing file metadata from S3
6. Exercise part 2: Writing analysis result to DynamoDB
7. Demo: Analyze large log file using EMR
”
Lambda comes from the Lambda
Calculus and refers to
anonymous functions in
programming.
”
AWS Lambda is a compute service
that runs your code in response to
events and automatically manages
the compute resources for you
AWS Lambda
› Hadoop as a service
› Price based on amount and type of cluster nodes
”
Accounts & Roles
Accounts
› https://739080850666.signin.aws.amazon.com/
console
”
Exercise
”
Exercise part 1:
Analyzing file metadata
from S3
1. Creating a Lambda function
› AWS Web Console -> Services -> Storage & Content Delivery ->
S3
› Create Bucket
› Bucket Name: ‘fi.solita.lambda.<user>.test
› Region: Ireland
› No logging
› Create
› Click on the bucket name and select Properties
› Create trigger for the Lambda function under Events
› Name: BucketEventToLambda
› Events: ObjectCreated
› Send To: Lambda function
› Lambda function ARN: <the one from step 1>, e.g. arn:aws:lambda:eu-
west-1:739080850666:function:fi-solita-lambda-samion-test
› Invocation role ARN: arn:aws:iam::739080850666:role/invocationrole
Testing
› mapper.js
› Reads through the input log file, skips unrelated lines and creates a
map from device names to device state change events
› reducer.js
› Reads through state change events of one device and counts them,
writes json with device name and count
Lambda - output
› Lambda: http://aws.amazon.com/lambda
› Lambda Developer Guide: http://docs.aws.amazon.com/lambda/latest/dg/lambda-dg.pdf
› Lambda blogs: https://aws.amazon.com/blogs/compute/category/aws-lambda/
› S3: http://aws.amazon.com/s3
› DynamoDB: http://aws.amazon.com/dynamodb
› EMR:
› Node.js SDK: http://aws.amazon.com/sdk-for-node-js
› Node.js Streaming EMR:
http://blogs.aws.amazon.com/bigdata/post/TxVX5RCSD785H6/Node-js-Streaming-MapRed
uce-with-Amazon-
EMR