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

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
Tweet

More Decks by Alex Casalboni

Other Decks in Technology

Transcript

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

    View full-size slide

  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

    View full-size slide

  3. What is serverless compu,ng?
    Quite a necessary “disclaimer”
    clda.co/sls-mul,-region

    View full-size slide

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

    View full-size slide

  5. Agenda
    Serverless Web APIs
    Why going mul,-region?
    Live Demo
    Gotchas and Challenges
    Cost Analysis
    clda.co/sls-mul,-region

    View full-size slide

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

    View full-size slide

  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)

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  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…

    View full-size slide

  11. Serverless API (Yaml)
    clda.co/sls-mul,-region

    View full-size slide

  12. Why going mul,-region?
    Pros & Cons of a “global” serverless app
    clda.co/sls-mul,-region

    View full-size slide

  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

    View full-size slide

  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

    View full-size slide

  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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  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

    View full-size slide

  20. Sample app (Web UI)
    clda.co/sls-mul,-region
    hFps://map.global.faas.website

    View full-size slide

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

    View full-size slide

  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)

    View full-size slide

  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)

    View full-size slide

  24. Route53 Latency-based Rou,ng
    One CNAME record for each region
    clda.co/sls-mul,-region
    “Latency” rou,ng policy
    Route53 Health Checks

    View full-size slide

  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)

    View full-size slide

  26. clda.co/sls-mul,-region
    CloudFront Cache Hit
    Edge-op,mized APIG
    Regional APIGs (LBR)
    CloudFront Cache Miss

    View full-size slide

  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!)

    View full-size slide

  28. Cost Analysis
    Is mulC-region always more expensive?
    clda.co/sls-mul,-region

    View full-size slide

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

    View full-size slide

  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

    View full-size slide

  31. clda.co/sls-mul,-region
    Is DDB always more expensive? *
    * excluding storage

    View full-size slide

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

    View full-size slide

  33. clda.co/sls-mul,-region
    DDB Cost Increase (Formula)
    R = # of regions
    x = RCU / WCU
    y = cost increase in %

    View full-size slide

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

    View full-size slide

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

    View full-size slide