Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Intro to Serverless: How to use AWS Lambda

Intro to Serverless: How to use AWS Lambda

Avatar for Aleksandar Simovic

Aleksandar Simovic

November 01, 2019
Tweet

More Decks by Aleksandar Simovic

Other Decks in Programming

Transcript

  1. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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)
  7. 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?!
  8. simalexan • >750,000 users per month • ~$107 / month.

    • Company size of two people • Migration to serverless - one month MindMup
  9. 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
  10. simalexan • Saving $49,990 / year • Development took 2

    weeks • Scales automatically • Operational costs: $0.09 per GB ScienceExchange