Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Workshop: Develop Serverless Applications with IBM Cloud Functions

526 views

Published on

Materials for the IBM Cloud Functions workshop at Index on February 20, 2018

https://developer.ibm.com/indexconf/

http://bit.ly/index-serverless

Learn the basics and strengths of IBM Cloud Functions (powered by Apache OpenWhisk). In this workshop, you will learn how to develop serverless applications composed of loosely coupled microservice-like functions. You'll play with the CLI and development tools becoming an IBM Cloud Functions star by implementing a weather bot using IBM's Weather Company Data service and Slack. You will also investigate how to use other components like our API Gateway integration. Finally, you will get a preview of new technologies we are developing for IBM Cloud Functions.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Workshop: Develop Serverless Applications with IBM Cloud Functions

  1. 1. IBM and Business Partner Use Only l Fast Start 2018 
 Develop Serverless Applications with IBM Cloud Functions © 2018 IBM Corporation l Index 2018 Daniel Krook
 Software Engineer & Developer Advocate Olivier Tardieu Software Engineer & Research Staff Member Priti Desai Naiyarah Hussein Mangesh Patankar
  2. 2. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Agenda / Learning Objectives 1. What is Serverless computing (Functions-as-a-Service)? 2. Why is Serverless better than a traditional approach? 3. What is IBM Cloud Functions (Apache OpenWhisk)? 4. How does IBM Cloud Functions fit into our cloud ecosystem? 5. What are the ideal IBM Cloud Functions use cases? 6. IBM Cloud Functions Shell and Composer 7. Additional material 8. Hands-on workshop
  3. 3. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Preparing your workstation 1. Go to bit.ly/serverless-index 2. Create an IBM Cloud account • Instructions: bit.ly/index-accounts 3. Download the bx CLI and Cloud Functions plug-in 4. Download the Shell tool 5. Download an IDE like Atom or VSCode
  4. 4. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Agenda 1. What is Serverless computing (Functions-as-a-Service)? 2. Why is Serverless better than a traditional approach? 3. What is IBM Cloud Functions (Apache OpenWhisk)? 4. How does IBM Cloud Functions fit into our cloud ecosystem? 5. What are the ideal IBM Cloud Functions use cases? 6. IBM Cloud Functions Shell and Composer 7. Additional material 8. Hands-on workshop
  5. 5. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts What is Serverless computing (Functions-as-a-Service)? Runs code only on-demand on a per-request basis Serverless deployment & operations model VM No servers Just code
  6. 6. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Runs code only on-demand on a per-request basis Scales on a per-request basis What is Serverless computing (Functions-as-a-Service)?
  7. 7. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Runs code only on-demand on a per-request basis Optimal utilization & granular pricing zzz time charged What is Serverless computing (Functions-as-a-Service)?
  8. 8. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Agenda 1. What is Serverless computing (Functions-as-a-Service)? 2. Why is Serverless better than a traditional approach? 3. What is IBM Cloud Functions (Apache OpenWhisk)? 4. How does IBM Cloud Functions fit into our cloud ecosystem? 5. What are the ideal IBM Cloud Functions use cases? 6. IBM Cloud Functions Shell and Composer 7. Additional material 8. Hands-on workshop
  9. 9. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts What is Serverless computing (Functions-as-a-Service)? Increasingfocusonbusinesslogic Decreasing concern (and control) over stack implementation Bare Metal VM VM VM Virtual machines Functions Containers
  10. 10. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Why is serverless better than a traditional approach? CF Container VM Application Process and Idle 2 Requests 1a Polling 1b Worry about scaling • When to scale? (mem-, cpu-, response time-, etc. driven?) • How fast can you scale? Worry about resiliency & cost • At least 2 processes for HA • Keep them running & healthy • Deployment in multiple regions Charged even when idling / not 100% utilized Continuous polling due to missing event programming model Traditional model Process and Idle
  11. 11. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Trigger 1 OpenWhisk Engine 2 Pool of Actions Js Swift Java PythonDocker Running Action Running Action Running Action 3 Scales inherently • One process per request No cost overhead for resiliency • No long running process to be made HA / multi-region Introduces event programming model Charges only for what is used • Only worry about code
 higher dev velocity, lower operational costs Serverless model Deploy actions within millisecs, run it, free up resources Why is serverless better than a traditional approach?
  12. 12. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Agenda 1. What is Serverless computing (Functions-as-a-Service)? 2. Why is Serverless better than a traditional approach? 3. What is IBM Cloud Functions (Apache OpenWhisk)? 4. How does IBM Cloud Functions fit into our cloud ecosystem? 5. What are the ideal IBM Cloud Functions use cases? 6. IBM Cloud Functions Shell and Composer 7. Additional material 8. Hands-on workshop
  13. 13. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts What is IBM Cloud Functions (Apache OpenWhisk)? Serverless platform to execute code in response to events
  14. 14. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Developed as
 open source software via Apache Foundation openwhisk.org Serverless platform to execute code in response to events What is IBM Cloud Functions (Apache OpenWhisk)?
  15. 15. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Managed service on
 IBM Cloud bluemix.net/openwhisk Serverless platform to execute code in response to events What is IBM Cloud Functions (Apache OpenWhisk)?
  16. 16. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts What is IBM Cloud Functions (Apache OpenWhisk)? Results Package (feed) Packages provide integration with external event sources Trigger (event) Data sources define events they emit as Triggers Rule (map) Action (function) Developers map Actions to Triggers via Rules Data sources define events they emit as Triggers. Developers map Actions to Triggers via Rules. T A R
  17. 17. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Supported Languages JS/NodeJS Swift Python Java Docker Go Haskell Scala . . . Multi- language Support Community Efforts … and more to come JS/NodeJS 8 Java Python 3 Swift 4 Docker Haskell … Scala PHP 7 What is IBM Cloud Functions (Apache OpenWhisk)?
  18. 18. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Non-blocking Blocking Periodic Support for different invocation models What is IBM Cloud Functions (Apache OpenWhisk)?
  19. 19. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Supports higher-level programming constructs Sequencing Conditionals Loops Error handling Parameter binding Default Name Default Parameters Default Value What is IBM Cloud Functions (Apache OpenWhisk)?
  20. 20. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Event Provider Open event emitter (consumer ecosystem) Open interface
 for event emitters What is IBM Cloud Functions (Apache OpenWhisk)?
  21. 21. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Event Provider Periodic IBM Cloudant IBM Message Hub Mobile Push Github IBM App Connect What is IBM Cloud Functions (Apache OpenWhisk)?
  22. 22. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts zzz time chargedGranular pricing Pay only for the exact time your actions run. When an action is not invoked, it’s not in memory, so you don’t pay anything. What is IBM Cloud Functions (Apache OpenWhisk)?
  23. 23. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Memory allocated (MB) Time executing (milliseconds) Instances executing simultaneously (count) Pricing model Time an action was running * memory allocated to action $0.000017 per GBs Free tier: 400,000 GBs What is IBM Cloud Functions (Apache OpenWhisk)?
  24. 24. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Allows packaging of pieces of a serverless application into a single project and deploy it in a vendor-agnostic way. Serverless Framework support What is IBM Cloud Functions (Apache OpenWhisk)?
  25. 25. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Agenda 1. What is Serverless computing (Functions-as-a-Service)? 2. Why is Serverless better than a traditional approach? 3. What is IBM Cloud Functions (Apache OpenWhisk)? 4. How does IBM Cloud Functions fit into our cloud ecosystem? 5. What are the ideal IBM Cloud Functions use cases? 6. IBM Cloud Functions Shell and Composer 7. Additional material 8. Hands-on workshop
  26. 26. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts How does IBM Cloud Functions fit into our cloud ecosystem? IoT Block Chain Health Zone FSS Zone Media Zone Discovery Conver- sation Natural Language Speech & Vision Tradeoff Analytics Retrieve & Rank Database Data Sets Analytics Management Messaging Mobile App Security API & Integration DevOps Containers Cloud Foundry Event-Driven Run-Times Compute Network Storage Security&Compliance Industry Cognitive Data Developer Tools Infrastructure Public Dedicated Multi-Tenant Single-Tenant Local Client DC & HW
  27. 27. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts How does IBM Cloud Functions fit into our cloud ecosystem? Bare Metal Virtual Server 
 or VMware Container IBM Cloud Functions Cloud Foundry Performance & Control Speed Language/
 Framework “Serverless” / “Event Driven” Apps Open PaaS Environment Maximum Performance & Control Maximum Portability Portability Leverage Existing Images & Tools
  28. 28. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts How does IBM Cloud Functions fit into our cloud ecosystem? • Control over runtime environment (runtimes, versions, minimal OS). • Greater reusability and portability of container images. • Great fit for bringing containerized apps and systems to the cloud. • No need to manage underlying OS. • Buildpacks provide influence over the runtime, giving as much or as little control (sensible defaults) as desired. • Great fit for many existing web apps with a stable programming model. • OS, runtime, and even container lifecycle is completely abstracted (serverless). • Autoscales in response to demand, with an associated granular cost model. • Great fit for emerging, non-HTTP, event-driven workloads involving IoT, data, messages. • More responsibility over package configuration (security patches). • Need to understand distributed systems. • Loss of control over operating system, 
 possibly at the mercy of buildpack versions. • Limited to HTTP/HTTPS • An emerging computing model, rapid innovation with less comprehensive and stable documentation, samples, tools, and best practices. Full control over infrastructure and maximum portability Focus on the application and let the platform handle the rest Auto-scaled, event-driven applications that respond to a variety of triggers Containers-as-a-Service Platform-as-a-Service Functions-as-a-Service
  29. 29. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Agenda 1. What is Serverless computing (Functions-as-a-Service)? 2. Why is Serverless better than a traditional approach? 3. What is IBM Cloud Functions (Apache OpenWhisk)? 4. How does IBM Cloud Functions fit into our cloud ecosystem? 5. What are the ideal IBM Cloud Functions use cases? 6. IBM Cloud Functions Shell and Composer 7. Additional material 8. Hands-on workshop
  30. 30. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Volatile and/or event-driven workload that can be split in smaller short-running pieces. Suited for sporadic as well as heavy load scenarios. What are the ideal IBM Cloud Functions use cases?
  31. 31. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts API Gateway support Allows to map API endpoints 
 to IBM Cloud Functions actions Serverless microservice APIs/backend Available for free, without limits Define Actions: getCostumer createCostumer
 deleteCostumer Define API Endpoints (URLs) and map to Actions GET: mydomain.com/…/customers POST: mydomain.com/…/customers
 DELETE: mydomain.com/…/customers 12 What are the ideal IBM Cloud Functions use cases? IBM Cloud Functions
  32. 32. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts getCostumer createCostumer
 deleteCostumer Easy to add and edit: Security (API key, API secret, OAuth validation, CORS) Rate-Limiting Map actions to API endpoints (OpenAPI Doc creation) Easy socialization (sharing, API key creation) Analytics (API calls, errors, response time) Test your API (API Explorer) Upload Swagger/OpenAPI Doc 3 2 1 What are the ideal IBM Cloud Functions use cases? IBM Cloud Functions
  33. 33. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Swift Action IBM API Gateway Openwhisk APIHi! Outsource compute-intensive tasks to a powerful & scalable serverless platform and implement your actions even without changing the programming language. Swift Action Mobile backend What are the ideal IBM Cloud Functions use cases? IBM Cloud Functions
  34. 34. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Data processing Openwhisk IBM Cloudant What are the ideal IBM Cloud Functions use cases? IBM Cloud Functions
  35. 35. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Data processing Openwhisk IBM Cloudant Ideally suited for working with multimedia data like audio, image and video data: Audio normalization Image rotation, sharpening, noise reduction or Thumbnail generation Image OCR’ing Video transcoding What are the ideal IBM Cloud Functions use cases? IBM Cloud Functions
  36. 36. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Cognitive Openwhisk IBM Cloudant What are the ideal IBM Cloud Functions use cases? IBM Cloud Functions
  37. 37. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Real-time Datastream Openwhisk IBM Message Hub IBM Cloudant Event processing/ Message Hub Managed Apache Kafka service for real- time build outs of data pipelines and streaming apps supports binary data What are the ideal IBM Cloud Functions use cases? IBM Cloud Functions
  38. 38. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Watson IoT Realtime Insights Trigger events based on IoT sensor data IOT Device 1Weather Update Trigger Watson IOT Platform Realtime Insights rules2 3 4 Trigger an Action IBM Cloud Functions What are the ideal IBM Cloud Functions use cases?
  39. 39. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Agenda 1. What is Serverless computing (Functions-as-a-Service)? 2. Why is Serverless better than a traditional approach? 3. What is IBM Cloud Functions (Apache OpenWhisk)? 4. How does IBM Cloud Functions fit into our cloud ecosystem? 5. What are the ideal IBM Cloud Functions use cases? 6. IBM Cloud Functions Shell and Composer 7. Additional material 8. Hands-on workshop
  40. 40. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts IBM Cloud Functions Shell and Composer
  41. 41. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts IBM Cloud Functions Shell and Composer
  42. 42. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts IBM Cloud Functions Shell and Composer
  43. 43. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Agenda 1. What is Serverless computing (Functions-as-a-Service)? 2. Why is Serverless better than a traditional approach? 3. What is IBM Cloud Functions (Apache OpenWhisk)? 4. How does IBM Cloud Functions fit into our cloud ecosystem? 5. What are the ideal IBM Cloud Functions use cases? 6. IBM Cloud Functions Shell and Composer 7. Additional material 8. Hands-on workshop
  44. 44. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts IBM hosted offering: bluemix.net/openwhisk Open source project: openwhisk.org Open source Slack: slack.openwhisk.org Additional material Learn more
  45. 45. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Github github.com/openwhisk Twitter twitter.com/openwhisk Medium medium.com/openwhisk SlideShare slideshare.net/openwhisk Learn more Learn more
  46. 46. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Agenda 1. What is serverless computing (Functions-as-a-Service)? 2. Why is serverless better than a traditional approach? 3. What is IBM Cloud Functions (Apache OpenWhisk)? 4. How does IBM Cloud Functions fit into our cloud ecosystem? 5. What are the ideal IBM Cloud Functions use cases? 6. IBM Cloud Functions Shell and Composer 7. Additional material 8. Hands-on workshop
  47. 47. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts What you will learn Hands-on workshop 1. In the end: How to develop a serverless weather bot 2. Basic concepts: Actions, Triggers, Rules, Packages 3. How to work with the IBM Cloud Functions CLI, UI, and Shell 4. How to work with our latest additions
 … API Gateway
 … Composer 5. … IBM App Connect & IBM Message Hub integration 6. How to work with additional tools
 … VS Code
 … Serverless Framework
 … NodeRED 7. What others have built 8. Free-style…
  48. 48. Index 2018 IBM Cloud Functions bit.ly/serverless-index bit.ly/index-accounts Important links Workshop:
 bit.ly/serverless-index Hands-on workshop Accounts:
 bit.ly/index-accounts

×