The Road to Serverless RESTish APIs

The Road to Serverless RESTish APIs

Or how we created hundreds of Lambda functions to expose our APIs to the world. Touching topics like project structure, web frameworks, performance, tooling, limitations and regrets :)

414738201197c2a837b986748c80e16e?s=128

Ricardo Torres

March 27, 2019
Tweet

Transcript

  1. The Road to Serverless RESTish APIs Ricardo Torres @ricardinhotorre

  2. None
  3. What exactly are we going to talk about?

  4. None
  5. Why serverless?

  6. None
  7. Knative, Kubeless, OpenFaaS, OpenWhisk...

  8. No servers

  9. Lack of resources: money, dev/ops

  10. Not my code, not my infra

  11. Less code, more maintainable

  12. Yes, it is cheap

  13. Source: https://aws.amazon.com/lambda/pricing/

  14. Side projects

  15. The Serverless Framework

  16. Choose my cloud provider

  17. None
  18. Serverless at New10

  19. Not too long ago...

  20. Serverless Commandments

  21. None
  22. Serverless APIs

  23. Is it even doable?

  24. Serverfull

  25. None
  26. None
  27. `https://${apiId}.execute-api.eu-west-1.amazonaws.com/${stage}/products` API Gateway

  28. Express& Koa& Hapi& [insert your shiny new framework here]

  29. Challenge accepted

  30. None
  31. https://middy.js.org/

  32. We need to talk about performance

  33. Duration: 141.58 ms Billed Duration: 200 ms Memory Size: 128

    MB Max Memory Used: 50 MB
  34. Where is my CPU usage?

  35. memorySize: 128

  36. Duration: 29.84 ms Billed Duration: 100 ms Memory Size: 1024

    MB Max Memory Used: 50 MB
  37. Cold starts

  38. https://youtu.be/oQFORsso2go

  39. Erm, okay... Is there anything I can do?

  40. Stay away from VPCs

  41. https://youtu.be/oQFORsso2go

  42. What's the size of my backend?

  43. https://packagephobia.now.sh/result?p=aws-sdk

  44. https://packagephobia.now.sh/result?p=aws-xray-sdk-core

  45. https://packagephobia.now.sh/result?p=aws-xray-sdk-core

  46. https://npm.im/serverless-webpack

  47. https://npm.im/lambda-warmer

  48. Security

  49. None
  50. None
  51. None
  52. Works on my local

  53. None
  54. None
  55. None
  56. None
  57. We'll get there

  58. Are we web λet?

  59. None
  60. Not my infra, not my uptime

  61. None
  62. None
  63. None
  64. Great success

  65. Sometimes it feels like we are reinventing the wheel

  66. Thank you! Ricardo Torres @ricardinhotorre