AWS Lambda in (a bit of) theory and in action. Adam Smolnik

Similar documents
AWS Lambda: Event-driven Code in the Cloud

AWS Lambda. 1.1 What is AWS Lambda?

AWS Solutions Architect Associate (SAA-C01) Sample Exam Questions

Zombie Apocalypse Workshop

Immersion Day. Getting Started with AWS Lambda. August Rev

SAA-C01. AWS Solutions Architect Associate. Exam Summary Syllabus Questions

Emulating Lambda to speed up development. Kevin Epstein CTO CorpInfo AWS Premier Partner

BERLIN. 2015, Amazon Web Services, Inc. or its affiliates. All rights reserved

Serverless Architecture Hochskalierbare Anwendungen ohne Server. Sascha Möllering, Solutions Architect

Reactive Microservices Architecture on AWS

Microservices without the Servers: AWS Lambda in Action

Diving into AWS Lambda

Amazon Web Services. Block 402, 4 th Floor, Saptagiri Towers, Above Pantaloons, Begumpet Main Road, Hyderabad Telangana India

How to go serverless with AWS Lambda

Training on Amazon AWS Cloud Computing. Course Content

PrepAwayExam. High-efficient Exam Materials are the best high pass-rate Exam Dumps

This document (including, without limitation, any product roadmap or statement of direction data) illustrates the planned testing, release and

Enroll Now to Take online Course Contact: Demo video By Chandra sir

MONITORING SERVERLESS ARCHITECTURES

Serverless Architectures with AWS Lambda. David Brais & Udayan Das

Getting Started with AWS IoT

Pocket: Elastic Ephemeral Storage for Serverless Analytics

ARCHITECTING WEB APPLICATIONS FOR THE CLOUD: DESIGN PRINCIPLES AND PRACTICAL GUIDANCE FOR AWS

AWS Tools for Microsoft Visual Studio Team Services: User Guide

How can you implement this through a script that a scheduling daemon runs daily on the application servers?

At Course Completion Prepares you as per certification requirements for AWS Developer Associate.

Aurora, RDS, or On-Prem, Which is right for you

Storage Systems for Serverless Analytics

AWS Lambda + nodejs Hands-On Training

ActiveNET. #202, Manjeera Plaza, Opp: Aditya Park Inn, Ameerpetet HYD

AWS Solution Architect Associate

SAMPLE CHAPTER. Event-driven serverless applications. Danilo Poccia. FOREWORD BY James Governor MANNING

GOING FULLY SERVERLESS

Building Games with AWS Mobile Services

Containers or Serverless? Mike Gillespie Solutions Architect, AWS Solutions Architecture

Programming in C# (20483)

AWS Toolkit for Eclipse User Guide

Amazon Search Services. Christoph Schmitter

Introduction to Amazon Web Services

Securing Serverless Architectures

Video on Demand on AWS

Lambda Architecture for Batch and Real- Time Processing on AWS with Spark Streaming and Spark SQL. May 2015

AWS Serverless Application Repository. Developer Guide

Level Up Your CF Apps with Amazon Web Services

Microservices Architekturen aufbauen, aber wie?

Intro to Big Data on AWS Igor Roiter Big Data Cloud Solution Architect

Frankfurt 26 & 27 September 2018

Research at PNNL: Powered by AWS NLIT 2018

Gabriel Villa. Architecting an Analytics Solution on AWS

Develop and test your Mobile App faster on AWS

Experiences with Serverless Big Data

What is Cloud Computing? What are the Private and Public Clouds? What are IaaS, PaaS, and SaaS? What is the Amazon Web Services (AWS)?

MATE-EC2: A Middleware for Processing Data with Amazon Web Services

Serverless Computing. Redefining the Cloud. Roger S. Barga, Ph.D. General Manager Amazon Web Services

IoT Device Simulator

CIT 668: System Architecture. Amazon Web Services

Containers, Serverless and Functions in a nutshell. Eugene Fedorenko

Going Serverless. Building Production Applications Without Managing Infrastructure

Testing in AWS. Let s go back to the lambda function(sample-hello) you made before. - AWS Lambda - Select Simple-Hello

CS 498RK FALL RESTFUL APIs

Basics of Cloud Computing Lecture 2. Cloud Providers. Satish Srirama

StreamAlert. Serverless, Real-Time Data / Enigma 2017

About Intellipaat. About the Course. Why Take This Course?

Building a Self-Defending Border. Shane Baldacchino, Solutions Architect, AWS Marcus Santos, Solutions Architect, AWS

DISTRIBUTED SYSTEMS [COMP9243] Lecture 8a: Cloud Computing WHAT IS CLOUD COMPUTING? 2. Slide 3. Slide 1. Why is it called Cloud?

Agenda. AWS Database Services Traditional vs AWS Data services model Amazon RDS Redshift DynamoDB ElastiCache

Amazon S3 Glacier. Developer Guide API Version

BERLIN. 2015, Amazon Web Services, Inc. or its affiliates. All rights reserved

Monitoring Serverless Architectures in AWS

Extend NonStop Applications with Cloud-based Services. Phil Ly, TIC Software John Russell, Canam Software

Building Apps in the Cloud to reduce costs up to 90%

Connecting the Unconnected: IoT Made Simple

AWS Serverless Architecture Think Big

4) An organization needs a data store to handle the following data types and access patterns:

Introduction to Database Services

Deep Dive on Amazon Elastic File System

CIT 668: System Architecture

AWS SQS for better architecture. 23 rd Dec'14 Saurabh S Bangad

Network Security & Access Control in AWS

MongoDB in AWS (MongoDB as a DBaaS)

Case Study: Amazon AWS. CSE Cloud Computing Prof. Douglas Thain University of Notre Dame

To benefit from this tutorial, you should have the desire to understand how Amazon Web Services can help you scale your cloud computing services.

Deep Dive Amazon Kinesis. Ian Meyers, Principal Solution Architect - Amazon Web Services

A Journey to DynamoDB

Microservices on AWS. Matthias Jung, Solutions Architect AWS

Amazon Web Services Cloud Computing in Action. Jeff Barr

AWS Administration. Suggested Pre-requisites Basic IT Knowledge

The Orion Papers. AWS Solutions Architect (Associate) Exam Course Manual. Enter

Automating Elasticity. March 2018

DevOps Tooling from AWS

Backtesting in the Cloud

Basics of Cloud Computing Lecture 2. Cloud Providers. Satish Srirama

High Availability Distributed (Micro-)services. Clemens Vasters Microsoft

Amazon Web Services (AWS) Solutions Architect Intermediate Level Course Content

Amazon Web Services Training. Training Topics:

Introduction to Cloud Computing

Programming in C#

Amazon Glacier. Developer Guide API Version

Write On Aws. Aws Tools For Windows Powershell User Guide using the aws tools for windows powershell (p. 19) this section includes information about

AWS Course Syllabus. Linux Fundamentals. Installation and Initialization:

Transcription:

AWS Lambda in (a bit of) theory and in action Adam Smolnik

A bit of a function theory The term Lambda (λ) originated from Lambda calculus - a theoretical universal model for describing functions and their computation

A function concept in programming Function represents a bit of reusable code May take arguments (aka parameters) May yield an outcome (pure function) and side effects (impure) Function s constituents Signature i.e. function s name, argument(s) and a return value* Executable code embedded within a part called Body public double exp(double a) { // Body comes here } * Definition of function s signature itself differs slightly across various programming languages and platforms

Pure vs. Impure function A pure function does not modify non-local data used beyond the function body An impure one may bring about side effects

Functional approach A function as the first class citizen in functional programming Declarative paradigm (as opposed to imperative one) Nowadays such a model has increased its importance as it is well suited for a concurrent, event-driven and reactive style of programming Enables runtime s optimization for bulk operations on data collections or for processing a great deal of arriving events With statelessness in place largely supports and enhances scalability and parallelism of operations

AWS Lambda service Enables implementations that are able to react quickly to events Runs code in response to events such as file uploads Provides means to extend other AWS services with custom logic deployed and launched directly on AWS Performs all operational and administrative tasks Including capacity provisioning, monitoring, applying security patches etc. Facilitates creating discrete, event-driven applications Can scale automatically from a few requests per day up to thousands per second

AWS Lambda implementation Currently supporting Node.js From nodejs.org "Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices"

Push and Pull models Push model an event producer (like Amazon S3) directly calls a Lambda function The unordered model the order Lambda processes events is unspecified Pull model AWS Lambda pulls the updates from the Stream (for AWS Kinesis or DynamoDB*) and then invokes a function The ordered model events are processed in order they are published to the Stream * DynamoDB Streams maintains a time ordered sequence of item level changes in a log for 24 hours

Essential AWS Lambda components Lambda Function itself along with dependent libraries Event Source Execution Role Invocation Role

Lambda Function syntax Skeleton code illustrates the straightforward syntax in which custom Node.js code (as a function) is written: exports.handler_name = function(event, context) { console.log("value1 = " + event.key1); console.log("value2 = " + event.key2);... context.done(null, "some message"); }

Event format Event structure and its content depend on its origin (source) Simple generic JSON structure for user-defined events { "key1":"value1", "key2":"value2", "key3":"value3" }

Execution Role Grants a function permissions to access AWS resources AWS Lambda assumes this role while executing code on behalf of the client

Invocation Role Grants requisite permissions for the event source to leverage AWS Lambda s components: For the push model grants permission to the event source to call a function In the pull model grants permission to AWS Lambda to allow pulling from a given Stream (AWS Kinesis or DynamoDB Stream)

Example of S3 Event content

Where Lambda can simplify design Amazon S3 Amazon Lambda Amazon SNS Amazon SQS Amazon EC2 DynamoDB object topic queue instance user bucket with objects DynamoDB table λ Node.js Auto Scaling

Some Lambda limit (valid during the Lambda preview) Memory available 128 1024 MB Ephemeral disk capacity 512 MB Total number of processes and threads (256?) 1024 Concurrent requests 25 per second Execution duration per request 60 seconds (max) Compressed function.zip file (20?) 30 MB Uncompressed function.zip file 250 MB

Costs incurred Pay-for-use pricing model Per request to call a function First 1 million requests per month are free $0.20 per 1 million requests henceforth Duration function s execution time $0.00001667 for every GB-second used Example A function with 512MB of memory allocated, run 3 million times in 1 month, and it took 2 second of processing each time. Request charges per month (1 000 000 = 1M) 3M requests 1M free tier requests = 2M Request charges = 2M * $0.2/M = $0.40 Compute charges per month Total compute (seconds) = 3M * 2s = 6M seconds Total compute (GB-s) = 6M * 512MB/1024 = 3M GB-s Total compute Free tier compute = 3M GB-s 0.4M free tier GB-s = 2.6M GB-s Compute charges = 2.6 * $0.00001667 = $43.34 Total charges Total charges = Request charges + Compute charges = $43.34 + $0.40 = $43.74 per month *The Lambda free tier does not automatically expire at the end of 12 month AWS Free Tier term

Potential downsides Less control over the code execution Troubleshooting issues due to business logic dispersed over various components Only Node.js implementation available for the time being

(Fast) Live Cooking Lambda at work Amazon S3 Amazon Lambda DynamoDB