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.

What can you do with lambda in 2020

289 views

Published on

Hosted on AWS User Group Peru.

Recording: https://www.youtube.com/watch?v=aKznpWyWyDY

Real-world serverless podcast: https://realworldserverless.com
Learn Lambda best practices: https://lambdabestpractice.com
Blog: https://theburningmonk.com
Consulting services: https://theburningmonk.com/hire-me
Production-Ready Serverless workshop: https://productionreadyserverless.com

Published in: Technology

What can you do with lambda in 2020

  1. 1. ? what can YOU DO with in 2020 Yan Cui @theburningmonk
  2. 2. What do you mean by ‘serverless’?
  3. 3. @theburningmonk theburningmonk.com “Serverless”
  4. 4. @theburningmonk theburningmonk.com
  5. 5. @theburningmonk theburningmonk.com Gojko Adzic It is serverless the same way WiFi is wireless. http://bit.ly/2yQgwwb
  6. 6. @theburningmonk theburningmonk.com Serverless means… don’t pay for it if no-one uses it don’t need to worry about scaling don’t need to provision and manage servers
  7. 7. @theburningmonk theburningmonk.com in other words, it’s a lot like taking a cab
  8. 8. @theburningmonk theburningmonk.com Ownership Fuel Navigate To get there! Focus on getting there!
  9. 9. @theburningmonk theburningmonk.com HW Ownership OS Runtime & Scale Code Physical Servers
  10. 10. @theburningmonk theburningmonk.com HW Ownership OS Runtime & Scale Code Physical Servers Virtual Machines
  11. 11. @theburningmonk theburningmonk.com HW Ownership OS Runtime & Scale Code Physical Servers Virtual Machines Containers
  12. 12. @theburningmonk theburningmonk.com HW Ownership OS Runtime & Scale Code Focus on getting there! Physical Servers Virtual Machines Containers Serverless
  13. 13. @theburningmonk theburningmonk.com HW Ownership OS Runtime & Scale Code Focus on getting there! Physical Servers Virtual Machines Containers Serverless
  14. 14. @theburningmonk theburningmonk.com Serviceful Self Managed Metered Usage
  15. 15. @theburningmonk theburningmonk.com
  16. 16. @theburningmonk theburningmonk.com API Gateway IOT Core SNS SQS S3
  17. 17. @theburningmonk theburningmonk.com auto-scaled by demand
  18. 18. @theburningmonk theburningmonk.com scales to zero
  19. 19. @theburningmonk theburningmonk.com scales to zero don’t pay for idle
  20. 20. @theburningmonk theburningmonk.com us-east-1a us-east-1b us-east-1c multi-AZ by default
  21. 21. @theburningmonk theburningmonk.com us-east-1a us-east-1b us-east-1c
  22. 22. @theburningmonk theburningmonk.com us-east-1a us-east-1b us-east-1c built-in load balancing
  23. 23. @theburningmonk theburningmonk.com us-east-1a us-east-1b us-east-1c
  24. 24. @theburningmonk theburningmonk.com us-east-1a us-east-1b us-east-1c DynamoDB global tables
  25. 25. @theburningmonk theburningmonk.com us-east-1a us-east-1b us-east-1c multi-region active-active
  26. 26. Why serverless?
  27. 27. @theburningmonk theburningmonk.com more Scalable (and scales faster!)
  28. 28. @theburningmonk theburningmonk.com Cheaper (don’t pay for idle servers)
  29. 29. @theburningmonk theburningmonk.com Resilience (built-in redundancy and multi-AZ)
  30. 30. @theburningmonk theburningmonk.com Secure
  31. 31. @theburningmonk theburningmonk.com idea production choose language + framework master language + framework figure out deployment configure AMI configure ELB configure autoscaling capacity planning over-provision for launch are we doing microservices? configure CI/CD
  32. 32. @theburningmonk theburningmonk.com idea production choose language + framework master language + framework figure out deployment configure AMI configure ELB configure autoscaling capacity planning over-provision for launch are we doing microservices? configure CI/CD
  33. 33. @theburningmonk theburningmonk.com idea production greater Velocity from idea to product
  34. 34. @theburningmonk theburningmonk.com youtube.com/watch?v=evsz__BDprs It used to take me longer to configure infrastructure for my application!
  35. 35. @theburningmonk theburningmonk.com minimise undifferentiated heavy-lifting
  36. 36. @theburningmonk theburningmonk.com less ops responsibility on your shoulders
  37. 37. Yan Cui http://theburningmonk.com @theburningmonk AWS user for 10 years
  38. 38. http://bit.ly/yubl-serverless
  39. 39. Yan Cui http://theburningmonk.com @theburningmonk Developer Advocate @
  40. 40. Yan Cui http://theburningmonk.com @theburningmonk Independent Consultant advisetraining delivery
  41. 41. theburningmonk.com/courses
  42. 42. theburningmonk.com/courses
  43. 43. realworldserverless.com
  44. 44. ? what can YOU DO with in 2020
  45. 45. @theburningmonk theburningmonk.com API Gateway Lambda DynamoDB
  46. 46. @theburningmonk theburningmonk.com API Gateway
  47. 47. @theburningmonk theburningmonk.com API Gateway over 70% cheaper
  48. 48. @theburningmonk theburningmonk.com https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html
  49. 49. @theburningmonk theburningmonk.com ALB 1 LCU gives you 25 new connections per second 3000 active connections per minute 0.4 GB per hour for Lambda function targets 1000 rule evaluations per second * averaged over an hour
  50. 50. @theburningmonk theburningmonk.com 1 TPS, 200ms avg latency, 1KB data processing / req API Gateway ALB $2.5921 x 60s x 60m x 24hr x 30days @ $1.00 per hour 24hr x 30days @ $0.0225 per hour + 1 x 24hr x 30days @ $0.008 per hour $21.96 $9.0721 x 60s x 60m x 24hr x 30days @ $3.50 per hour REST HTTP
  51. 51. @theburningmonk theburningmonk.com 1,000 TPS, 200ms avg latency, 1KB data processing / req 25 new connections per second 3000 active connections per minute 0.4 GB per hour for Lambda function targets 1000 rule evaluations per second = 1000 / 25 = 40 LCU = 1000 x 60s / 3000 = 20 LCU = 1kb x 1000 x 60s x 60m / 0.4 GB = 8.58 LCU = 1000 / 1000 = 1 LCU
  52. 52. @theburningmonk theburningmonk.com 1,000 TPS, 200ms avg latency, 1KB data processing / req API Gateway ALB $25921000 x 60s x 60m x 24hr x 30days @ $1.00 per hour 24hr x 30days @ $0.0225 per hour + 40 x 24hr x 30days @ $0.008 per hour $246.6 $90721000 x 60s x 60m x 24hr x 30days @ $3.50 per hour REST HTTP
  53. 53. @theburningmonk theburningmonk.com services that pay by uptime are orders-of-magnitude cheaper when running at scale
  54. 54. @theburningmonk theburningmonk.com ALB canary deploy with stickiness routing based on HTTP headers or query string params
  55. 55. @theburningmonk theburningmonk.com “What about cold starts? I need predictable latency!”
  56. 56. @theburningmonk theburningmonk.com first, try to optimize cold start duration so they’re within acceptable latency range
  57. 57. @theburningmonk theburningmonk.com then, consider using Provisioned Concurrency as a fallback
  58. 58. @theburningmonk theburningmonk.com REST APIs
  59. 59. @theburningmonk theburningmonk.com “What about websockets?”
  60. 60. @theburningmonk theburningmonk.com API Gateway AppSync IoT Core
  61. 61. @theburningmonk theburningmonk.com API Gateway AppSync IoT Core
  62. 62. @theburningmonk theburningmonk.com
  63. 63. @theburningmonk theburningmonk.com API Gateway Lambda OnConnect
  64. 64. @theburningmonk theburningmonk.com API Gateway Lambda OnConnect DynamoDB
  65. 65. @theburningmonk theburningmonk.com API Gateway Lambda OnConnect DynamoDB Lambda OnDisconnect
  66. 66. @theburningmonk theburningmonk.com API Gateway DynamoDBLambda
  67. 67. @theburningmonk theburningmonk.com API Gateway DynamoDBLambda
  68. 68. @theburningmonk theburningmonk.com low-level construct where YOU have to manage connection mapping
  69. 69. @theburningmonk theburningmonk.com no support for broadcasts (e.g. broadcasting to a million connected users equates to fetching 1M items from DynamoDB and then make 1M API calls to API Gateway…)
  70. 70. @theburningmonk theburningmonk.com API Gateway AppSync IoT Core
  71. 71. @theburningmonk theburningmonk.com
  72. 72. @theburningmonk theburningmonk.com
  73. 73. @theburningmonk theburningmonk.com
  74. 74. @theburningmonk theburningmonk.com scalable, easy to use, but requires GraphQL
  75. 75. @theburningmonk theburningmonk.com API Gateway AppSync IoT Core
  76. 76. @theburningmonk theburningmonk.com
  77. 77. @theburningmonk theburningmonk.com requires sig v4 signing (possibly using credentials obtained through Cognito Identity Pool)
  78. 78. @theburningmonk theburningmonk.com messages are always MQTT messages
  79. 79. @theburningmonk theburningmonk.com REST APIs WebSockets
  80. 80. @theburningmonk theburningmonk.com “What if I want to build a GraphQL API instead of REST?”
  81. 81. @theburningmonk theburningmonk.com schema server data sources DynamoDB RDS ElasticSearch AppSync Lambda
  82. 82. @theburningmonk theburningmonk.com AWS AppSync scalable & multi-az out of the box
  83. 83. @theburningmonk theburningmonk.com AWS AppSync scalable & multi-az out of the box pay as you use ($4.00 per Million)
  84. 84. @theburningmonk theburningmonk.com AWS AppSync scalable & multi-az out of the box pay as you use ($4.00 per Million) built-in caching (extra $)
  85. 85. @theburningmonk theburningmonk.com AWS AppSync scalable & multi-az out of the box pay as you use ($4.00 per Million) built-in caching (extra $) built-in metrics through CloudWatch built-in logging through CloudWatch Logs
  86. 86. @theburningmonk theburningmonk.com AWS AppSync scalable & multi-az out of the box pay as you use ($4.00 per Million) built-in caching (extra $) built-in metrics through CloudWatch built-in logging through CloudWatch Logs no servers to manage
  87. 87. @theburningmonk theburningmonk.com REST APIs WebSockets GraphQL APIs
  88. 88. @theburningmonk theburningmonk.com “Can I implement data pipelines with serverless?”
  89. 89. @theburningmonk theburningmonk.com Kinesis Lambda ?Publisher(s)
  90. 90. @theburningmonk theburningmonk.com realworldserverless.com
  91. 91. @theburningmonk theburningmonk.com Kinesis Lambda ?Publisher(s) Firehose S3 Athena
  92. 92. @theburningmonk theburningmonk.com Kinesis Lambda ?Publisher(s) Firehose S3 Athena Kinesis Analytics Lambda
  93. 93. @theburningmonk theburningmonk.com Kinesis Lambda ?Publisher(s) Firehose S3 Athena Kinesis Analytics Firehose ?
  94. 94. @theburningmonk theburningmonk.com Kinesis Lambda ?Publisher(s) Firehose S3 Athena Kinesis Analytics Kinesis ?
  95. 95. @theburningmonk theburningmonk.com REST APIs WebSockets GraphQL APIs Big Data
  96. 96. @theburningmonk theburningmonk.com
  97. 97. @theburningmonk theburningmonk.com
  98. 98. @theburningmonk theburningmonk.com
  99. 99. @theburningmonk theburningmonk.com
  100. 100. @theburningmonk theburningmonk.com
  101. 101. @theburningmonk theburningmonk.com CloudTrail EventBridge Lambda
  102. 102. @theburningmonk theburningmonk.com
  103. 103. @theburningmonk theburningmonk.com
  104. 104. @theburningmonk theburningmonk.com
  105. 105. @theburningmonk theburningmonk.com Config EventBridge Lambda
  106. 106. @theburningmonk theburningmonk.com REST APIs WebSockets GraphQL APIs Big Data DevOps/DevSecOps
  107. 107. @theburningmonk theburningmonk.com “How do I model complex business workflows?”
  108. 108. @theburningmonk theburningmonk.com Step Functions
  109. 109. @theburningmonk theburningmonk.com orchestration service that allows you to model workflows as state machines
  110. 110. @theburningmonk theburningmonk.com design with JSON https://states-language.net/spec.html
  111. 111. @theburningmonk theburningmonk.com
  112. 112. @theburningmonk theburningmonk.com Step Functions OOP class instanceexecution input arguments
  113. 113. @theburningmonk theburningmonk.com start a state machine via.. StepFunctions .startExecution(req) .promise()
  114. 114. @theburningmonk theburningmonk.com start a state machine via.. API Gateway StepFunctions .startExecution(req) .promise()
  115. 115. @theburningmonk theburningmonk.com start a state machine via.. EventBridge including cron StepFunctions .startExecution(req) .promise() API Gateway
  116. 116. @theburningmonk theburningmonk.com
  117. 117. @theburningmonk theburningmonk.com
  118. 118. @theburningmonk theburningmonk.com
  119. 119. @theburningmonk theburningmonk.com
  120. 120. @theburningmonk theburningmonk.com
  121. 121. @theburningmonk theburningmonk.com state transitions
  122. 122. @theburningmonk theburningmonk.com
  123. 123. @theburningmonk theburningmonk.com $25 PER MILLION
  124. 124. @theburningmonk theburningmonk.com $25 PER MILLION 15X LAMBDA PRICING!
  125. 125. @theburningmonk theburningmonk.com https://aws.amazon.com/about-aws/whats-new/2019/12/introducing-aws-step-functions-express-workflows
  126. 126. @theburningmonk theburningmonk.com
  127. 127. @theburningmonk theburningmonk.com bit.ly/complete-guide-to-aws-step-functions
  128. 128. @theburningmonk theburningmonk.com REST APIs WebSockets GraphQL APIs Big Data DevOps/DevSecOps Business Workflows
  129. 129. @theburningmonk theburningmonk.com “Can I encode videos with Lambda?”
  130. 130. @theburningmonk theburningmonk.com S3 Lambda ?
  131. 131. @theburningmonk theburningmonk.com S3 Lambda Elemental MediaConvert
  132. 132. @theburningmonk theburningmonk.com S3 Lambda Elemental MediaConvert
  133. 133. @theburningmonk theburningmonk.com an X min video file is likely going to take X mins to encode
  134. 134. @theburningmonk theburningmonk.com S3 Lambda Step Functions
  135. 135. @theburningmonk theburningmonk.com split
  136. 136. @theburningmonk theburningmonk.com Map split
  137. 137. @theburningmonk theburningmonk.com split Map …
  138. 138. @theburningmonk theburningmonk.com split Map …
  139. 139. @theburningmonk theburningmonk.com split Map … { … } { … } { … } { … } { … }
  140. 140. @theburningmonk theburningmonk.com split Map … { … } { … } { … } { … } { … } [{ … }, { … } … ]
  141. 141. @theburningmonk theburningmonk.com Map split stitch
  142. 142. @theburningmonk theburningmonk.com Map split stitch
  143. 143. @theburningmonk theburningmonk.com Transcode video segments in parallel. Reduced processing time from ~20 mins to ~2 mins.
  144. 144. @theburningmonk theburningmonk.com REST APIs WebSockets GraphQL APIs Big Data DevOps/DevSecOps Video Encoding Business Workflows
  145. 145. @theburningmonk theburningmonk.com “Event-driven architectures are all the rage, how does it look like?”
  146. 146. @theburningmonk theburningmonk.com “What do I use as the event bus?”
  147. 147. @theburningmonk theburningmonk.com EventBridge SNS prefer over
  148. 148. @theburningmonk theburningmonk.com EventBridge SNS
  149. 149. @theburningmonk theburningmonk.com EventBridge schema discovery & schema registry
  150. 150. @theburningmonk theburningmonk.com EventBridge content-based filtering enables a centralized event bus
  151. 151. @theburningmonk theburningmonk.com EventBridge AWS Services 3rd Partners Your Application
  152. 152. @theburningmonk theburningmonk.com EventBridge AWS Services 3rd Partners Your Application Lambda Lambda Lambda
  153. 153. @theburningmonk theburningmonk.com EventBridge AWS Services 3rd Partners Your Application Lambda Lambda Lambda
  154. 154. @theburningmonk theburningmonk.com “How do I handle failures?”
  155. 155. @theburningmonk theburningmonk.com DLQ
  156. 156. @theburningmonk theburningmonk.com SNS, SQS, Lambda, EventBridge
  157. 157. @theburningmonk theburningmonk.com FAILURE DESTINATION
  158. 158. @theburningmonk theburningmonk.com FAILURE DESTINATION
  159. 159. @theburningmonk theburningmonk.com FAILURE DESTINATION
  160. 160. @theburningmonk theburningmonk.com FAILURE DESTINATION
  161. 161. @theburningmonk theburningmonk.com
  162. 162. @theburningmonk theburningmonk.com MORE targets Stream invocations too!
  163. 163. @theburningmonk theburningmonk.com prefer Lambda Destinations to DLQs (both can be used side-by-side)
  164. 164. @theburningmonk theburningmonk.com what about OnSuccess?
  165. 165. @theburningmonk theburningmonk.com OnSuccess
  166. 166. @theburningmonk theburningmonk.com
  167. 167. @theburningmonk theburningmonk.com REST APIs WebSockets GraphQL APIs Big Data DevOps/DevSecOps Event-Driven Architecture Video Encoding Business Workflows
  168. 168. @theburningmonk theburningmonk.com
  169. 169. @theburningmonk theburningmonk.com LambdaAlexa Skills
  170. 170. @theburningmonk theburningmonk.com REST APIs WebSockets GraphQL APIs Big Data DevOps/DevSecOps Event-Driven Architecture Video Encoding Business Workflows Alexa skills
  171. 171. @theburningmonk theburningmonk.com
  172. 172. @theburningmonk theburningmonk.com IOT Core Lambda
  173. 173. @theburningmonk theburningmonk.com REST APIs WebSockets GraphQL APIs Big Data DevOps/DevSecOps Alexa skills IOT Event-Driven Architecture Video Encoding Business Workflows
  174. 174. @theburningmonk theburningmonk.com REST APIs WebSockets GraphQL APIs Big Data DevOps/DevSecOps Alexa skills IOT Event-Driven Architecture Video Encoding Business Workflows
  175. 175. @theburningmonk theburningmonk.com “When is serverless not the right choice?”
  176. 176. @theburningmonk theburningmonk.com What are your non-functional requirements?
  177. 177. @theburningmonk theburningmonk.com Can Lambda meet your performance and scaling requirements?
  178. 178. @theburningmonk theburningmonk.com What’s the Total Cost of Ownership (TCO) for serverless?
  179. 179. @theburningmonk theburningmonk.com
  180. 180. @theburningmonk theburningmonk.com https://go.aws/2XThRxK
  181. 181. @theburningmonk theburningmonk.com https://go.aws/2XThRxK
  182. 182. @theburningmonk theburningmonk.com But, sometimes, the infrastructure far outweighs staffing cost
  183. 183. @theburningmonk theburningmonk.com
  184. 184. @theburningmonk theburningmonk.com
  185. 185. @theburningmonk theburningmonk.com lambdabestpractice.com
  186. 186. https://theburningmonk.com/hire-me AdviseTraining Delivery “Fundamentally, Yan has improved our team by increasing our ability to derive value from AWS and Lambda in particular.” Nick Blair Tech Lead
  187. 187. @theburningmonk theburningmonk.com github.com/theburningmonk

×