Node Without Servers: Event-Driven Computing with AWS Lambda



Similar documents
AWS Lambda. Developer Guide

Thing Big: How to Scale Your Own Internet of Things.

Achieving Continuous Delivery with AWS Lambda and Codeship

Microservices on AWS

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

Amazon Simple Notification Service. Developer Guide API Version

Building Cloud-powered Mobile Apps

Amazon Glacier. Developer Guide API Version

Introduction to Cloud Computing on Amazon Web Services (AWS) with focus on EC2 and S3. Horst Lueck

AIST Data Symposium. Ed Lenta. Managing Director, ANZ Amazon Web Services

Cloud Computing with Amazon Web Services and the DevOps Methodology.

Last time. Today. IaaS Providers. Amazon Web Services, overview

Alfresco Enterprise on AWS: Reference Architecture

Extending Tizen Native Framework with Node.js

Hadoop & Spark Using Amazon EMR

Introduction to AWS in Higher Ed

Adobe Summit 2015 Lab 712: Building Mobile Apps: A PhoneGap Enterprise Introduction for Developers

Managing Multi-Tiered Applications with AWS OpsWorks

Last time. Today. IaaS Providers. Amazon Web Services, overview

AWS Key Management Service. Developer Guide

Razvoj Java aplikacija u Amazon AWS Cloud: Praktična demonstracija

Introduction to DevOps on AWS

EEDC. Scalability Study of web apps in AWS. Execution Environments for Distributed Computing

Scalable Application. Mikalai Alimenkou

CAPTURING & PROCESSING REAL-TIME DATA ON AWS

A Comparison of Clouds: Amazon Web Services, Windows Azure, Google Cloud Platform, VMWare and Others (Fall 2012)

Best Practices for Sharing Imagery using Amazon Web Services. Peter Becker

CloudFTP: A free Storage Cloud

QML and JavaScript for Native App Development

TECHNOLOGY WHITE PAPER Jun 2012

Customer Master Presentation - Contents

Amazon Web Services Annual ALGIM Conference. Tim Dacombe-Bird Regional Sales Manager Amazon Web Services New Zealand

How AWS Pricing Works May 2015

TECHNOLOGY WHITE PAPER Jan 2016

Amazon Kinesis and Apache Storm

Intro to AWS: Storage Services

Amazon Elastic Compute Cloud Getting Started Guide. My experience

STORAGE S3 API. Storage S3 API. Programmer s Guide. Revision 1.0 (20/04/2012) Lunacloud Tel: Southampton Row info@lunacloud.

Web Application Deployment in the Cloud Using Amazon Web Services From Infancy to Maturity

Using Cloud Services for Building Next Generation Mobile Apps

Scaling in the Cloud with AWS. By: Eli White (CTO & mojolive) eliw.com - mojolive.com

Architecting Applications to Scale in the Cloud

AWS Data Pipeline. Developer Guide API Version

MOBILE APPLICATIONS AND CLOUD COMPUTING. Roberto Beraldi

The Cloud as a Computing Platform: Options for the Enterprise

Vincent Gabriel. Summary. Experience. Senior Software Developer at Landmark Network

Storage Solutions in the AWS Cloud. Miles Ward Enterprise Solutions Architect

A programming model in Cloud: MapReduce

JAVA IN THE CLOUD PAAS PLATFORM IN COMPARISON

ur skills.com

PaaS - Platform as a Service Google App Engine

Building native mobile apps for Digital Factory

Ground up Introduction to In-Memory Data (Grids)

Cloud Powered Mobile Apps with Azure

Drupal Performance Tuning

Amazon Cloud Storage Options

Integrating Mobile apps with your Enterprise

Scalable Architecture on Amazon AWS Cloud

ArcGIS 10.3 Server on Amazon Web Services

Financial Services Grid Computing on Amazon Web Services January 2013 Ian Meyers

How To Use Aws.Com

Android Fundamentals 1

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

Background on Elastic Compute Cloud (EC2) AMI s to choose from including servers hosted on different Linux distros

Using SUSE Studio to Build and Deploy Applications on Amazon EC2. Guide. Solution Guide Cloud Computing.

RED HAT CLOUD SUITE FOR APPLICATIONS

PIE. Internal Structure

Course Summary. Prerequisites

A Comparative Study on Vega-HTTP & Popular Open-source Web-servers

Primex Wireless OneVue Architecture Statement

ArcGIS Web Mapping. Sam Berg, esri

MarkLogic Server. MarkLogic Server on Amazon EC2 Guide. MarkLogic 8 February, Copyright 2015 MarkLogic Corporation. All rights reserved.

Making Your ColdFusion Apps Highly Available. Brian Klaas Johns Hopkins Bloomberg School of Public Health

Servers. Servers. NAT Public Subnet: /20. Internet Gateway. VPC Gateway VPC: /16

Introducing PgOpenCL A New PostgreSQL Procedural Language Unlocking the Power of the GPU! By Tim Child

Enterpise Mobility Lexicon & Terminology

SCALING BUILDING ENERGY MODELING HORIZONTALLY IN THE CLOUD WITH OPENSTUDIO

Continuous Delivery on AWS. Version 1.0 DO NOT DISTRIBUTE

CLOUD COMPUTING WITH AWS An INTRODUCTION. John Hildebrandt Solutions Architect ANZ

Open Source Technologies on Microsoft Azure

PhoneGap Build Starter

Web Development. How the Web Works 3/3/2015. Clients / Server

Building A Self-Hosted WebRTC Project

Linux A first-class citizen in Windows Azure. Bruno Terkaly bterkaly@microsoft.com Principal Software Engineer Mobile/Cloud/Startup/Enterprise

Getting Started with Android Programming (5 days) with Android 4.3 Jelly Bean

Writing standalone Qt & Python applications for Android

New Features for Sybase Mobile SDK and Runtime. Sybase Unwired Platform 2.1 ESD #2

Responsive, resilient, elastic and message driven system

How AWS Pricing Works

Kony Mobile Application Management (MAM)

AquaLogic Service Bus

Cross-Platform ASP.NET 5 For the Cloud. Anthony Sneed

Aspera Direct-to-Cloud Storage WHITE PAPER

Middleware- Driven Mobile Applications

Transcription:

Node Without Servers: Event-Driven Computing with AWS Lambda Brian Klaas Johns Hopkins Bloomberg School of Public Health bklaas@jhu.edu @brian_klaas www.iterateme.com

Events

What is and how does it work? What good can do for me?

+ =

Code Memory setting Timeout setting

Event

Full AWS Linux AMI (ami-dfc39aef, Linux Kernel 3.14.35-28.38.amzn1.x86_64) Node v0.10.33 ImageMagick AWS JS SDK v2.1.22 Up to 1024MB RAM and 512MB of ephemeral disk storage

* May not actually be Docker *

Every event Every config change Every code change = new ( )

Lambda = one function

exports.handler = function(event, context) { console.log('hello', event); // more JS goes here context.done(null, 'Success'); }

Initialization code Context? Handler code Event Code terminates Timeout context.done context.success context.fail All callbacks finished

Never assume Lambda will re use a container.

Pricing: Charged by Compute Time Free Tier First million requests are free 400,000 GB-seconds of compute time 220 hours of free compute time per month @ 512MB of RAM Paid Tier $0.20 per 1 million requests thereafter $0.00001667 for every GB-second http://aws.amazon.com/lambda/pricing * You also have to pay for in/out data transfer fees

Event Driven Computing

Event notification Run a compute cycle Shut down

Where do events come from?

S3 Kinesis Cognito SNS DynamoDB CloudFormation AWS SDK Custom Events

S3 Fast, durable, cheap storage Events on file put/post, copy

SNS Many AWS services can post to SNS GitHub has a post-commit hook

AWS SDK Custom Events All SDKs support Lambda function invocation Java, Ruby, Node, Python, JavaScript, PHP,.NET, ios, Android, and the CLI

Lambda in Action

1 Template Example

IAM Identity Access Management

IAM Users Groups Roles AccessKey + SecretKey

IAM

Roles = JSON IAM { "Version":"2008-10-17", "Id":"http referrer policy example", "Statement":[ { "Sid":"Allow get requests referred by www.mysite.com and mysite.com", "Effect":"Allow", "Principal":"*", "Action":"s3:GetObject", "Resource":"arn:aws:s3:::example-bucket/*", "Condition":{ "StringLike":{ "aws:referer":[ "http://www.mysite.com/*", "http://mysite.com/*" ] } } } ] }

How do we know it s done?

When responding to events from within AWS, we don t.

4 Notifying that It s Done

Options for notifying that work is complete SQS SNS (http, SMS, email) DynamoDB table File updating in S3

Only one Lambda function per S3 bucket.

5 Custom Events

Custom Events AWS SDK AWS CLI

Event body [Event context]

Custom events are synchronous calls Default invocation-type: RequestResponse invocation-type: Event for async events

Invoking via the CLI using ColdFusion

Invoking via the CLI Name of your Lambda function aws lambda invoke --function-name myfunctionname --payload '{"key1":"value1", "key2":"value2", "key3":"value3"}' outfile.txt JSON passed in to the Lambda function as the event structure. Response is written to a file. This is the name of that file. Note you can specify --payload file://input.txt to use a file instead.

On demand Node functionality

What Good is Lambda Anyway?

Asynchronous task server Background job processor

S3 Event Handler

Media conversion service ImageMagick Native modules AWS Elastic Transcoder

Real time analytics aggregator

Microservice backend?

Lambda is great when every event is independent and can be processed incrementally.

Beyond JS/Node

Native Node Modules Statically compile on an Amazon Linux AMI Install the module as part of your Node app on the same AMI ZIP up the function, binary, and the node_modules folder https://aws.amazon.com/blogs/compute/nodejs-packages-in-lambda/

Any Compiled Executable Make sure it s compiled for the Linux AMD64 architecture Make sure it can run standalone or is visible to /bin/bash/ or /usr/bin/python Use child_process.spawnsync() to make sure the child process finishes before context.success/done() executes Include the executable in the ZIP file you upload to Lambda https://aws.amazon.com/blogs/compute/running-executables-in-aws-lambda/

Java Native Java support announced April 9

Go Do!

Code at github.com/brianklaas Session evaluation! Brian Klaas Johns Hopkins Bloomberg School of Public Health bklaas@jhu.edu @brian_klaas www.iterateme.com