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

AWS DevDay Berlin 2019 - Going Global With Serv...

AWS DevDay Berlin 2019 - Going Global With Serverless

Customers are often looking at running their services at global scale, deploying applications to multiple regions. While it has traditionally been hard to do this, often requiring months of engineering work, serverless has changed the game!This hands-on talk will help you understand how to build two different versions of a multi-region, active-active serverless backend. Come learn the pros-and-cons of DNS routing versus IP Anycast, and see how you can leverage serverless services like Route 53, Global Accelerator, API Gateway, the Application Load Balancer, AWS Lambda and DynamoDB Global tables to build global scale, serverless applications.

Darko Mesaros

October 25, 2019
Tweet

More Decks by Darko Mesaros

Other Decks in Technology

Transcript

  1. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. B E R L I N 2 0 1 9 - 1 0 - 2 5
  2. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 2 0 1 9 - 1 0 - 2 5 Building Global Services with Serverless! Darko Meszaros Specialist Solutions Architect Amazon Web Services @darkosubotica ln/darko-mesaros
  3. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Darko Mesaroš / Darko Meszaros / Дарко Месарош ! → " → # → $ → % Berlin % @darkosubotica ln/darko-mesaros $(whoami)
  4. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Before we get started, let’s take a look at some fundamentals.
  5. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. What is Reliability?
  6. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. What is Availability?
  7. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Availability by the numbers
  8. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Availability by the numbers Level of availability Percent uptime Downtime per year Downtime per day 1 Nine 90% 36.5 Days 2.4 Hours 2 Nines 99% 3.65 Days 14 Minutes 3 Nines 99.9% 8.76 Hours 86 Seconds 4 Nines 99.99% 52.6 Minutes 8.6 Seconds 5 Nines 99.999% 5.26 Minutes 0.86 Seconds 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 1 Nine 2 Nines 3 Nines 4 Nines 5 Nines Daily Downtime in Seconds Daily Downtime in Seconds
  9. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Availability in parallel A = 1 – (1 – Ax)2 Part X Part X
  10. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Availability in parallel Component Availability Downtime X 99% (2-nines) 3 days 15 hours Two X in parallel 99.99% (4-nines) 52 minutes Three X in parallel 99.9999% (6-nines) 31 seconds
  11. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Component redundancy increases availability significantly!
  12. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 22 Geographic Regions 69 Availability Zones (AZs) 3 regions and 9 more Availability Zones announced
  13. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. AWS Region and availability zones Region Availability zone a Availability zone b Availability zone c data center data center data center data center data center data center data center data center data center
  14. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Multi-AZ architecture Region Availability zone a Availability zone b Availability zone c Application Application Application
  15. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Multi-region Region Availability zone a Availability zone b Availability zone c Application Region Availability zone a Availability zone b Availability zone c Application Application Application Application Application
  16. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Increase in availability, increases cost and complexity
  17. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Increase in availability, increases cost and complexity
  18. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Why build a multi-region active-active architecture?
  19. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Improve latency for end-users ~300ms ~140ms
  20. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Improve availability and disaster recovery Applications in US West Applications in US East Users from San Francisco Users from New York Service 1 Service 2 Service 3 Service 4 Service 1 Service 2 Service 3 Service 4
  21. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Prerequisites to building a multi-region architecture.
  22. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. CAP Theorem Consistency Availability Partition Tolerance Data is consistent. All nodes see the same state. Every request is non-failing. Service still responds as expected if some nodes crash. Distributed System In the presence of a network partition, you must choose between consistency and availability!
  23. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Embrace eventual consistency … if no new updates are made to a given data item, eventually all accesses to that item will return the last updated value. Availability An eventually consistent system can return any value before it converges!! https://en.wikipedia.org/wiki/Eventual_consistency Distributed System Every request is non-failing.
  24. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Secure and reliable global network
  25. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Global Network
  26. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Multi-AZ architecture Region Availability zone a Availability zone b Availability zone c Application Application Application
  27. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Serverless components Region Availability zone a Availability zone b Availability zone c Serverless Services
  28. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Why serverless components?? No provisioning, no management Pay for value Fault Tolerant and Automatic scaling Highly available and secure
  29. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Build high performance, globally distributed applications Low latency reads & writes to locally available tables Disaster proof with multi-region redundancy Easy to set up and no application rewrites required Globally dispersed users Replica (N. America) Replica (Europe) Replica (Asia) Global App Global Table Amazon DynamoDB Global Tables Fully managed, multi-master, multi-region database
  30. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon S3 cross-region replication Bucket with objects Bucket with objects
  31. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Global routing with Route 53
  32. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Latency based routing Region Region Application Application
  33. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Geo-based routing Region us-east-1 Region us-west-2 Application Application
  34. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Weighted round robin routing Region us-east-1 Region us-west-2 Application Application
  35. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. DNS failover Region us-east-1 Region us-west-2 Application Application
  36. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. AWS Global Accelerator
  37. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Global Accelerator Application Load Balancer Lambda Function DynamoDB Global Table Route 53 Latency Routing API Gateway Regional API Lambda Function DynamoDB Global Table
  38. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Region us-east-1 Region us-west-2 Global Table https://globalddb.rup12.xyz
  39. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Region us-east-1 Region us-west-2 Global Table
  40. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Region us-east-1 Region us-west-2 Global Table
  41. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Region us-east-1 Region us-west-2 https://globalddb.rup12.xyz Regional API Endpoint Custom Domain Name Regional API Endpoint Custom Domain Name API Gateway
  42. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Region us-east-1 Region us-west-2 Global Table
  43. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Route53: Traffic Policy
  44. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Health checks with Route 53
  45. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Region us-east-1 Region us-west-2 Global Table https://globalddb.rup12.xyz Voilà!
  46. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Failover testing – Follow the link bellow https://read.acloud.guru/building-a-serverless-multi-region-active-active-backend-36f28bed4ecf
  47. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Region eu-central-1 Region eu-west-2 Global Table 2x Anycast IPs Global Accelerator
  48. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Region eu-central-1 Region eu-west-2 Global Table
  49. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Region eu-central-1 Region eu-west-2 Global Table
  50. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Region eu-central-1 Region eu-west-2 Global Table
  51. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Region eu-central-1 Region eu-west-2 Global Table 2x Anycast IPs Global Accelerator Voilà!
  52. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Failover testing – Follow the link bellow https://medium.com/@adhorn/multi-region-serverless-backend-reloaded-1b887bc615c0
  53. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. DNS isn’t perfect!
  54. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. https://medium.com/@adhorn
  55. Thank you! © 2019, Amazon Web Services, Inc. or its

    affiliates. All rights reserved. Darko Meszaros @darkosubotica
  56. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Please rate the session