Intro to Serverless: How to use AWS Lambda

Intro to Serverless: How to use AWS Lambda

12c5965da9836aa0fa3b2806a4ac73a8?s=128

Aleksandar Simovic

November 01, 2019
Tweet

Transcript

  1. simalexan Meet Sloba

  2. simalexan

  3. simalexan

  4. simalexan Have you heard of serverless? Its me!

  5. simalexan No server management / ops Scales per use Autofailover

    Don’t pay 
 for idle
  6. simalexan Business is more profitable Faster delivery

  7. simalexan Code needs to run on servers! Serverless? That’s not

    the point! You’re an idiot
  8. simalexan How to use AWS Lambda on a 
 real-world

    use case Intro to Serverless
  9. simalexan Aleksandar Simovic Senior Software Engineer @ ScienceExchange AWS Serverless

    Hero coauthor of “Serverless Applications with Node.js” book AWS SAM & Lambda Builders Contributor Co-organizer of JS Belgrade, Serverless Belgrade, Wardley Maps Belgrade meetups
  10. simalexan What is 
 serverless, really?

  11. @simalexan Server OS Platform App

  12. @simalexan

  13. @simalexan

  14. @simalexan

  15. @simalexan

  16. simalexan But that Lambda
 runs on
 an AWS server?

  17. simalexan It is serverless, 
 the same way WIFI is

    wireless. Gojko Adzic
  18. simalexan

  19. None
  20. simalexan Ok, now I want 
 to hear more…

  21. simalexan Event model 
 (with listeners)

  22. simalexan Not just AWS Lambda And so many more…

  23. simalexan • Node.js, Java, Python, C#, Go, many others as

    well • Power from 128MB - 3GB • CPU and network allocated proportionately • Synchronous or async • Voice enabled devices • Securely grant access to resources and VPCs • Fine grained control Your own code Simplified resource model Flexible use Flexible authorization AWS Lambda
  24. simalexan • Cloud9 - online editor • VSCode, Eclipse tools

    • Metrics for requests, errors, and throttles • Built-in logs • Use processing, threads, 
 /tmp, sockets • AWS SDK built-in • Persist data using external storage • No affinity or access to underlying infrastructure Authoring functions Monitoring and logging Programming model Stateless AWS Lambda
  25. simalexan • Pay for compute time in 100ms increments •

    No hourly, daily or monthly minimums • No per-device cost • Never pay for idle • 1 million requests FREE every month, every customer Pay-per-use pricing
  26. simalexan What can we use 
 this “serverless” for?

  27. simalexan • Static websites • Complex web apps • Apps

    and services • Mobile • IoT • Real-time • MapReduce • Batch • Text / SMS Chatbots • Voice assistants • Voice enabled devices • Machine Learning • AR / VR Web Apps Backends Data processing Chatbots Amazon Alexa Machine learning Common serverless use cases
  28. simalexan Who uses Lambda?

  29. simalexan

  30. simalexan Show me the ones you were personally know or

    are involved!
  31. simalexan Real world use case #1

  32. simalexan

  33. simalexan

  34. simalexan CodePen’s problems (2016)

  35. simalexan • Team of mostly frontend devs + one DevOps

    • Ruby on Rails backend • Many preprocessors that needs full isolation • > 200k requests/hour in peak • Unexpected peaks 
 (you never know when some pen will become popular)
  36. simalexan

  37. simalexan • Full isolation between services
 • Auto-scaling (up to

    5000 parallel requests)
 • Decreased infrastructure cost 
 (250 million requests costs $1180/month)
 • More DevOps time for RoR part of the app
 • Frontend developers with superpowers?!
  38. simalexan More!

  39. simalexan Real world use case #2 MindMup

  40. simalexan

  41. simalexan • >750,000 users per month • ~$107 / month.

    • Company size of two people • Migration to serverless - one month MindMup
  42. simalexan Real world use case #3 ScienceExchange

  43. simalexan • Integration with an accounting SaaS • Constant influx

    of events • Potential costs $50,000 / year • Necessary for finance, data science and analytics teams • Decided to build the project in-house 
 (estimation 3 months) ScienceExchange
  44. simalexan Science Exchange

  45. simalexan • Saving $49,990 / year • Development took 2

    weeks • Scales automatically • Operational costs: $0.09 per GB ScienceExchange
  46. simalexan How can I do it?

  47. simalexan Demo Time!

  48. simalexan

  49. simalexan serverless.pub/book “Serverless Applications with Node.js" claudia40 40% off Hvala!