AWS April Webinar Series - AWS Lambda: Event-driven Code for Devices and the Cloud

Download AWS April Webinar Series - AWS Lambda: Event-driven Code for Devices and the Cloud

Post on 18-Jul-2015

804 views

Category:

Technology

1 download

Embed Size (px)

TRANSCRIPT

<ul><li><p> 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved.</p><p>Tim Wagner, AWS Lambda General Manager</p><p>April 30, 2015</p><p>AWS Lambda: Event-driven </p><p>Code for Devices and the Cloud</p></li><li><p>Event-Driven Compute in the Cloud</p><p>Launched last November at re:Invent</p><p> Lambda functions: Stateless, request-driven code execution</p><p> Triggered by events in other services:</p><p> PUT to an Amazon S3 bucket</p><p> Write to an Amazon DynamoDB table</p><p> Record in an Amazon Kinesis stream</p><p> Makes it easy to</p><p> Transform data as it reaches the cloud</p><p> Perform data-driven auditing, analysis, and notification</p><p> Kick off workflows</p></li><li><p>Data Triggers: Amazon S3</p><p>Amazon S3 </p><p>Bucket Events</p><p>AWS Lambda</p><p>Original </p><p>image</p><p>Thumbnailed</p><p>image</p><p>1</p><p>2</p><p>3</p></li><li><p>Data Triggers: Amazon DynamoDB</p><p>AWS LambdaAmazon DynamoDB</p><p>Table and Stream</p><p>Send SNS </p><p>notifications</p><p>Update another table</p></li><li><p>Dynamic content generation based on </p><p>incoming news text and images</p><p>Real time log processing for </p><p>prediction analytics</p><p>Thumbnailing installation site </p><p>photos for mobile use</p><p>Real time processing and recording of </p><p>inbound traffic from a range of social </p><p>media platforms</p><p>Large scale distributed search </p><p>across blog content</p><p>Operational analytics and </p><p>real time troubleshooting</p></li><li><p>Building Backends with Lambda</p><p>Mobile Compute Request/response</p><p> AWS Mobile SDK</p><p> Easy Personalization</p><p>for devices</p><p>for end usersAWS LambdaMobile App</p></li><li><p>Event-Driven Compute in the Cloud and for Devices </p><p>Request / response</p><p> Create instantly scalable backends for mobile apps</p><p> Run stateless computations for web apps without servers</p><p> Build cloud-based IoT ecosystems using C/C++ libraries</p><p> Complements the existing asynchronous functionality</p></li><li><p>AWS Mobile SDK</p><p>Build high quality mobile apps quickly and easily.</p><p>AWS Lambda now available in:</p><p> AWS mobile SDK for Android</p><p> AWS iOS mobile SDK</p></li><li><p>Easy Personalization</p><p>Which app/device is she using? </p><p>Which end user is this?</p><p>Name and version of app,</p><p>Make and model of device,</p><p>Platform and local, </p><p>Cognito identity,</p><p>Cognito identity pool?</p><p>?</p></li><li><p>Demo: Building a Mobile </p><p>Backend with AWS Lambda</p></li><li><p>No Infrastructure to Manage</p><p>Focus on business logic, not infrastructure</p><p>Upload your code; AWS Lambda handles</p><p> Capacity</p><p> Scaling</p><p> Deployment</p><p> Monitoring</p><p> Logging</p><p> Web service front end</p><p> Security patching</p></li><li><p>Automatic Scaling</p><p>Lambda scales to match the event rate</p><p>Dont worry about over or under provisioning</p><p>Pay only for what you use</p><p>New app or successful app, Lambda matches your scale</p></li><li><p>Bring Your Own Code</p><p>Create threads and processes, run </p><p>batch scripts or other executables, </p><p>and read/write files in /tmp.</p><p>Include any library with your </p><p>Lambda function code, even </p><p>native libraries.</p></li><li><p>Fine-Grained Pricing</p><p>Buy compute time in 100ms increments</p><p>Low request charge</p><p>No hourly, daily, or monthly minimums</p><p>No per-device fees</p><p>Never pay for idle</p><p>Free Tier</p><p>1M requests and 400,000 GB-s of compute.</p><p>Every month, every customer.</p></li><li><p>Using AWS Lambda</p></li><li><p>Calling Lambda Functions</p><p>Call from mobile or web apps</p><p> Wait for a response or just send an event and keep going</p><p> AWS SDK, AWS Mobile SDK, REST API, CLI</p><p>Send events from Amazon S3 or SNS:</p><p> One event per Lambda invocation, 3 attempts</p><p>Process DynamoDB changes or Amazon Kinesis records as events:</p><p> Ordered model with multiple records per event</p><p> Unlimited retries (until data expires)</p><p>Default limits</p><p> 100 concurrent executions and 1,000 invokes per second</p><p> Increases available via AWS customer service!</p></li><li><p>Writing Lambda Functions</p><p>The Basics</p><p> Stock node.js</p><p> AWS SDK comes built in and ready to use</p><p> Lambda handles inbound traffic</p><p>Stateless</p><p> Use S3, DynamoDB, or other Internet storage for persistent data</p><p> Dont expect affinity to the infrastructure (you cant log in to the box)</p><p>Familiar</p><p> Use processes, threads, /tmp, sockets, </p><p> Bring your own libraries, even native ones</p></li><li><p>Configuring the Lambda Functions</p><p>1. Pick a name.</p><p>2. Pick a size.</p><p> Set memory to any size from 128MB to 1GB, in 64MB steps</p><p> Receive an equivalent portion of other resources (disk, network, compute power, etc.)</p><p> Easy, single-dial solution to set price/performance preference.</p><p> Lambda tells you how much memory you used, so you can tune this setting.</p><p>3. Pick an event source (or several).</p></li><li><p>AWS Lambda or EC2 / ECS?</p><p>AWS Lambda</p><p> Request-driven</p><p> Prioritizes ease of use one OS, default hardware choice</p><p> AWS owns and manages the infrastructure</p><p> Implicit scaling; just make requests</p><p>Amazon EC2 and ECS</p><p> Infrastructure rental</p><p> Flexible choose instance type, OS, language, </p><p> You own and configure the infrastructure</p><p> Scale by provisioning instances or containers</p></li><li><p>New Features</p></li><li><p>New AWS Event Sources for Lambda</p><p>Amazon Simple Notification Service (SNS)</p><p> Easily target, route, transform, filter, or audit messages</p><p> Trigger an AWS Lambda function by sending it notifications</p><p> Turn Amazon CloudWatch alarms into actions</p><p>Lambda</p><p>Function</p><p>SNS</p></li><li><p>New AWS Event Sources for Lambda</p><p>Amazon Cognito</p><p> Before: Easily synchronize user data across their devices</p><p> Now: Take action when that data changes</p><p> Examples: Verify and respond to game state updates</p><p>Lambda</p><p>Function</p><p>Cognito</p></li><li><p>How Can You Use These Features?</p><p>I want to send customized </p><p>messages to </p><p>different users</p><p>SNS + Lambda</p><p>I want to send an offer when a user </p><p>runs out of lives in </p><p>my game</p><p>Cognito + </p><p>Lambda + SNS</p><p>I want to transform the records in a </p><p>click stream or an </p><p>IoT data stream</p><p>Kinesis + Lambda</p></li><li><p>New Features</p><p>Cross-account access support Create functions that you can share with others</p><p> Send events from S3 buckets in a different AWS account</p><p>AWS CloudTrail integration</p><p> Track AWS Lambda API calls in AWS CloudTrail logs</p><p> Audit access logs easily with a Lambda function</p><p>AWS CloudFormation Custom Resources</p><p> Run a Lambda function any time you create, update, or delete a CloudFormation stack</p><p> Easily run custom actions without provisioning infrastructure</p></li><li><p>Improved Metrics and Diagnostics</p><p>Discover and take action with free metrics</p><p> AWS Lambda automatically monitors your functions</p><p> Amazon CloudWatch metrics for requests, errors, running time</p><p> New concurrent request throttle metric</p><p>Automated logging with time-based sorting</p><p> AWS Lambda automatically logs for you</p><p> Sort CloudWatch Logs by time of last entry</p><p> See creation time in log stream names and easily filter on it</p></li><li><p>Coming Soon: Java!</p><p>You can already call Java programs from Lambda functions </p><p>today</p><p> Java and other languages are automatically included in your filesystem viewdont wait to start using them!</p><p> Freezing ensures you dont pay repeatedly for JVM boot</p><p>Well make this even easier with built-in support for AWS Lambda functions written in Java.</p></li><li><p>Three Next Steps</p><p>1. Go to the AWS console to create and test your first Lambda </p><p>function. The first 1M requests each month are on us!</p><p>2. Use AWS Lambda to add custom logic to S3, DynamoDB, </p><p>SNS, Kinesis, or Cognito eventsno servers required!</p><p>3. Use the AWS Mobile SDK and Lambda to quickly create an </p><p>instantly scalable mobile app. Start by visiting </p><p>http://aws.amazon.com/mobile/sdk</p></li><li><p>Visit http://aws.amazon.com/lambda, the AWS </p><p>Compute blog, and the Lambda forum to learn </p><p>more and get started using Lambda.</p><p>Thank you!</p></li></ul>