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

AWS DevDay Berlin 2019 - Going Global With Serverless

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.

8db231d3fe08b46242f6e0e45c95eee1?s=128

Darko Mesaros

October 25, 2019
Tweet

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. Data replication.
  30. © 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
  31. © 2019, Amazon Web Services, Inc. or its affiliates. All

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

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

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

    rights reserved. Geo-based routing Region us-east-1 Region us-west-2 Application Application
  35. © 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
  36. © 2019, Amazon Web Services, Inc. or its affiliates. All

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

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

    rights reserved.
  39. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved.
  40. © 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
  41. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved.
  42. © 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
  43. © 2019, Amazon Web Services, Inc. or its affiliates. All

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

    rights reserved.
  45. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved.
  46. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved.
  47. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved.
  48. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved.
  49. © 2019, Amazon Web Services, Inc. or its affiliates. All

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

    rights reserved.
  51. © 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
  52. © 2019, Amazon Web Services, Inc. or its affiliates. All

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

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

    rights reserved. Health checks with Route 53
  55. © 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à!
  56. © 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
  57. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved.
  58. © 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
  59. © 2019, Amazon Web Services, Inc. or its affiliates. All

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

    rights reserved.
  61. © 2019, Amazon Web Services, Inc. or its affiliates. All

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

    rights reserved.
  63. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved.
  64. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved.
  65. © 2019, Amazon Web Services, Inc. or its affiliates. All

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

    rights reserved.
  67. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved.
  68. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved.
  69. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved.
  70. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved.
  71. © 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à!
  72. © 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
  73. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved.
  74. © 2019, Amazon Web Services, Inc. or its affiliates. All

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

    rights reserved.
  76. © 2019, Amazon Web Services, Inc. or its affiliates. All

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

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

    rights reserved. Please rate the session