$30 off During Our Annual Pro Sale. View Details »

How to Build a Regionally Distributed Serverless Architecture

How to Build a Regionally Distributed Serverless Architecture

Serverless is being billed as the future of cloud computing. Widely embraced by developers to offload most of the heavy-lifting infrastructure management, serverless is also gaining ground in the enterprise.

In this webinar, Alex Casalboni, Senior Software Engineer at Cloud Academy and Rupak Ganguly, Enterprise Solutions Architect at Serverless Inc. will explore the architectural advantages of globally distributed serverless applications through a live demo.

Alex Casalboni

January 30, 2018

More Decks by Alex Casalboni

Other Decks in Technology


  1. clda.co/sls-mul,-region 1/30/2018 How to build a regionally distributed Serverless architecture

  2. About us Alex Casalboni @alex_casalboni Rupak Ganguly Enterprise Solu.ons Architect

    @ Serverless Inc. @rupakg Sr. So6ware Engineer @ Cloud Academy Inc. clda.co/sls-mul,-region
  3. What is serverless compu,ng? Quite a necessary “disclaimer” clda.co/sls-mul,-region

  4. Today’s topic What is this webinar about? What tools/technology? clda.co/sls-mul,-region

  5. Agenda Serverless Web APIs Why going mul,-region? Live Demo Gotchas

    and Challenges Cost Analysis clda.co/sls-mul,-region
  6. Serverless Web APIs Some context & reference architecture clda.co/sls-mul,-region

  7. Serverless APIs on AWS Zero administra,on clda.co/sls-mul,-region Built-in elas,city Event-driven

    architecture Never pay for idle (or over-provision)
  8. clda.co/sls-mul,-region [cloudcraft.co]

  9. clda.co/sls-mul,-region [cloudcraft.co]

  10. Edge-Op,mized API Endpoints It was the default un,l Nov 2017

    clda.co/sls-mul,-region Managed CloudFront distribu-on Already “global”, but…
  11. Serverless API (Yaml) clda.co/sls-mul,-region

  12. Why going mul,-region? Pros & Cons of a “global” serverless

    app clda.co/sls-mul,-region
  13. Mul,-region architectures on AWS 15+ AWS regions (and coun,ng!) clda.co/sls-mul,-region

    Independent and redundant components Increased availability and reliability
  14. Serverless cross-region failover High Availability (Ac-ve-Ac-ve setup) clda.co/sls-mul,-region Regional fallback

    in case of large-scale disasters Improved overall Latency Latency-based rou-ng & Health Checks
  15. Handling persistent data replica,on Amazon DynamoDB Global Tables (NoSQL) clda.co/sls-mul,-region

    Mul--region & Mul--master setup Automa,c data replica-on across regions (via streams) No code changes or app rewrite
  16. clda.co/sls-mul,-region [cloudcraft.co]

  17. Live Demo A sample app in acCon clda.co/sls-mul,-region

  18. Sample app (API Design) clda.co/sls-mul,-region github.com/alexdebrie/serverless-mul.-region

  19. Sample app (Stack) clda.co/sls-mul,-region Serverless Framework (v1.25.0) Two Lambda Func,ons,

    one DynamoDB Table Three AWS Regions (Frankfurt, Dublin, and Oregon) One API endpoint: hdps:/ /global.faas.website/hello
  20. Sample app (Web UI) clda.co/sls-mul,-region hFps://map.global.faas.website

  21. Gotchas and Challenges Let’s get technical! clda.co/sls-mul,-region

  22. Serverless Framework Support serverless-domain-manager plugin clda.co/sls-mul,-region serverless-dynamodb-autoscaling plugin Mul,ple deployments

    (once per region, eventually in parallel) Not 100% CloudForma,on (bash scripts for cer,ficates, custom domains, global table, and latency records)
  23. Amazon Cer,ficate Manager (ACM) One cer-ficate for each region (for

    APIG custom domain) clda.co/sls-mul,-region Semi-automa,c one-,me process (human interven,on) Automa,c renewal (no ac,on required)
  24. Route53 Latency-based Rou,ng One CNAME record for each region clda.co/sls-mul,-region

    “Latency” rou,ng policy Route53 Health Checks
  25. Regional endpoints Vs. Edge-op,mized endpoints (APIG) Regional endpoints don’t use

    CloudFront’s CDN (latency) clda.co/sls-mul,-region CloudFront’s cache might speed up your LBR endpoint * * It doesn’t work on the same custom domain (cer,ficates & DNS)
  26. clda.co/sls-mul,-region CloudFront Cache Hit Edge-op,mized APIG Regional APIGs (LBR) CloudFront

    Cache Miss
  27. DynamoDB Global Tables Only 5 regions supported for now clda.co/sls-mul,-region

    Tables must be empty to add a new region Don’t forget Auto Scaling (write capacity is shared!)
  28. Cost Analysis Is mulC-region always more expensive? clda.co/sls-mul,-region

  29. clda.co/sls-mul,-region Mono-region Mul,-region* * guess,mate for 2 regions

  30. clda.co/sls-mul,-region Overall cost almost +30% Similar cost for Lambda and

    APIGateway DynamoDB cost ~2x Increased mul,-region costs * * guess,mate for 2 regions
  31. clda.co/sls-mul,-region Is DDB always more expensive? * * excluding storage

  32. clda.co/sls-mul,-region DDB Cost Increase (R=2)

  33. clda.co/sls-mul,-region DDB Cost Increase (Formula) R = # of regions

    x = RCU / WCU y = cost increase in %
  34. clda.co/sls-mul,-region DDB Cost Increase (R=2,3,5)

  35. Thank you! clda.co/sls-mul,-region Q & A 1/30/2018