AWS Lambda: Event-driven Code in the Cloud

Download AWS Lambda: Event-driven Code in the Cloud

Post on 11-Aug-2015




2 download

Embed Size (px)


<ol><li> 1. 2015, Amazon Web Services, Inc. or its affiliates. All rights reserved AWS Lambda: Event-Driven Code in the Cloud Dr. Tim Wagner, General Manager AWS Lambda July 9, 2015 | New York, NY </li><li> 2. Apps Without Servers Whats the easiest server to manage? The one somebody else takes care of! </li><li> 3. Five Sample Use Cases for AWS Lambda Serverless Microservices Adding a Feature to Amazon S3 Extending Platforms Scalable Mobile Backends Real-Time Streaming Analysis </li><li> 4. Requirements Effortless scaling / no provisioning Built-in rollout Highly available by default BYOC* Never pay for idle *Bring Your Own Code </li><li> 5. A Scalable Mobile Backend </li><li> 6. A Scalable Mobile Backend Without Coding the Mobile Backend </li><li> 7. Building a Mobile Backend with AWS Lambda 1. Create an Amazon DynamoDB database. 2. Pick the Simple Mobile Backend sample code in the Lambda console. 3. Build your app with the AWS Mobile SDK. AWS Lambda Lets see it in action </li><li> 8. Building a Mobile Backend: Add-ons Want users to log in? Use Amazon Cognito Identity. Need device-specific rendering? Device info is in the functions context object. AWS Lambda </li><li> 9. What Makes This Easy? Eliminating the distance between Works on my box and Ship it to customers! Never Pay for Idle Built-In Web Server Auto Patch Auto Deploy Auto Scale Built-In Monitoring Built-In Logging Built-In Security HTTP Endpoint </li><li> 10. Diving Deeper: Programming Model Two main languages Node.js Java 8 Plus Scala, Clojure, and other jvm languages Run background processes Node.js or Java Also Python, csh, or your own executable Native libraries are welcome! </li><li> 11. Serverless Microservices </li><li> 12. HTTP Endpoints Lets see it in action </li><li> 13. SquirrelBin Architecture Static web content served from Amazon S3 Codeless Backend + Acorn Execution Acorns Stored in Amazon DynamoDB </li><li> 14. New Capabilities for AWS Lambda Functions Public HTTP endpoints Throttling controls API Key management Results caching SDK Generation and Swagger support Apache Velocity templates API mocking </li><li> 15. Learn More About Amazon API Gateway Build and Manage Your APIs with Amazon API Gateway Simon Poile, General Manager 4:30 p.m.5:30 p.m. Room 1E12 </li><li> 16. Diving Deeper: Programming Model Run your code sync or async from Any AWS SDK AWS Mobile SDK REST call AWS Command Line Interface Inside AWS Lambda itself (yep, it self-hosts) Code is pre-credentialed Choose a role and Lambda will assume it for you Cross account access is supported </li><li> 17. Extending Other Platforms </li><li> 18. Compute for Connected Devices Alexa Skills Kitbuild voice-enabled apps Uses AWS Lambda as a connected device/IoT platform </li><li> 19. Slack Demo Architecture Alexa, tell Slack to send, Im giving the demo now. Message Retrieval (via Amazon SQS queue) Kevin says, Break a leg! Message Upload (via Slack API) Team (channel users) Slack </li><li> 20. GitHub Event Responder Events from GitHub Team (repository users) GitHub Amazon SNS Messages </li><li> 21. Ricky Robinett Developer Evangelist </li><li> 22. AWS Lambda Integration Partners </li><li> 23. What Makes This Easy? For the Platform Provider Nothing to host Nothing to license No capacity management No web service to run Low latency sync calls Fire and forget events For the App Developer Low cost Forever free tier No infrastructure No boilerplate code Language choice No library restrictions </li><li> 24. Diving Deeper: Resource Sizing AWS Lambda offers 12 power levels Higher levels offer more memory and more CPU power 128 MB, lowest CPU power 1.5 GB, highest CPU power Higher power levels == lower latency for CPU- bound and bursty tasks Compute price scales with the power level </li><li> 25. Extending Amazon S3 </li><li> 26. Extending Amazon S3 with Auto-Compress Amazon S3 Bucket Events AWS Lambda Original object Compressed object 1 2 3 </li><li> 27. How to Add a Feature to Amazon S3 1. Grab Java compress sample from the web. 2. Start with the Amazon S3 event sample: 1. GET original from S3 2. Compress 3. PUT compressed version back to S3 3. Pick some S3 bucket(s) to apply it to. Lets see it in action </li><li> 28. What Makes This Easy? Request-Level Scaling! Who knows the event rate? S3 and Lambda! You cant over or under provision (by design) Pay only for what you use </li><li> 29. AWS Services You Can Extend Today Amazon S3 Amazon DynamoDB AWS CloudTrail Amazon CloudWatch Logs AWS CloudFormation Amazon Kinesis Amazon Cognito Amazon SNS </li><li> 30. Amazon CloudWatch Alarm Responder Amazon CloudWatch Alarms SNS Messages </li><li> 31. Real-Time Streaming Analysis </li><li> 32. Easy Real-Time Streaming Architecture Data Ingestion with Amazon Kinesis (PUT record) Records retrieved by AWS Lambda Your code runs once per [batch of] records Amazon S3 Amazon DynamoDB Smart Devices Click Stream Log Data Amazon Redshift Learn more: Watch the Lambda Webinar on Streaming Data </li><li> 33. Diving Deeper: Retries and Event Ordering Three possibilities: Call your AWS Lambda function synchronously. Using the AWS SDK? Set your retry logic there. Direct RESTful call to Lambda? You control retries entirely. Ordering is up to the caller. Amazon S3 or SNS trigger your Lambda function, or you call Lambda asynchronously. 3 tries, total, then the event is discarded Unordered (loosely ordered) Lambda polls an Amazon Kinesis or Amazon DynamoDB update stream for you No limit on tries, ordering preserved </li><li> 34. Aside: Shards and Ordering Shard 1 Record 1a Record 1b </li><li> 35. Aside: Shards and Ordering Shard 1 Record 1a Record 1b Shard 2 Record 2a Record 2b Shard 3 Record 3a Record 3b </li><li> 36. Aside: Shards and Ordering Shard 1 Shard 2 Shard 3 Record 3a Record 3b </li><li> 37. Practicalities </li><li> 38. AWS Lambda Regions AWS Lambda Region NEW: Tokyo launched 6/29 </li><li> 39. Fine-grained pricing Buy compute time in 100 ms increments Low request charge No hourly, daily, or monthly minimums No per-device fees Never pay for idle. Free Tier 1 million requests and 400,000 GBs of compute. Every month, every customer. </li><li> 40. Build and Deploy Integration Jenkins Grunt AWS CloudFormation Amazon S3 Partners </li><li> 41. Coming Soon: Function Versioning How it works: Develop at HEADupdates replace existing code Publish to create an immutable snapshot Every function has a default version (which can be HEAD) Callers can request The default version A specific version HEAD APIs support staging and versioning (now) </li><li> 42. Weve Been Busy. Now, Its Your Turn. </li><li> 43. Go to the AWS Lambda console, create a function, and run it. (The first million invokes are on us!) </li><li> 44. Congrats, youre a Lambda function expert! Add an event source or an HTTP endpoint. </li><li> 45. Build the worlds easiest mobile backend. (Hint: Start with the built-in CRUD sample!) </li><li> 46. Follow AWS Lambda! AWS Lambda Forum Your Feedback is Important to AWS Please complete the session evaluation and tell us what you think. (I read every comment!) </li><li> 47. NEW YORK </li></ol>