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

Building Multi-Region Serverless Architecture and Breaking them using Chaos Engineering

Building Multi-Region Serverless Architecture and Breaking them using Chaos Engineering

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 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.
While having a multi-region architecture increases the availability of your application, it also brings new sets of challenges.
One of these challenge is ensuring that the failover procedures work when needed since the last thing you want during a disaster is fixing the failover procedures. This session will also look into using chaos engineering techniques to make sure that when the real disaster happens, the failover is successful.

E6c942c0f8e6042fbd47fcd3c4113b90?s=128

Adrian Hornsby

February 03, 2020
Tweet

Transcript

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

    rights reserved. Building multi-region, active-active serverless applications Adrian Hornsby Principal Evangelist Amazon Web Services @adhorn
  2. Why build a global architecture?

  3. Once upon a time … Origin

  4. And now . . . Origin ~300ms

  5. Origin Improve latency for end users Origin

  6. 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
  7. Amazon global network

  8. Origin Cross-region VPC peering Origin

  9. Amazon S3 cross-region replication Bucket with objects Bucket with objects

  10. 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
  11. Active-Active | Active-Passive | What to do?

  12. Serverless cost model is a huge advantage here!

  13. © 2020, Amazon Web Services, Inc. or its affiliates. All

    rights reserved.
  14. © 2020, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Route 53 > API Gateway > Lambda > DynamoDB
  15. Global Table https://global.adhorn.me AWS Lambda AWS Lambda Amazon DynamoDB Amazon

    DynamoDB Amazon API Gateway Amazon API Gateway Amazon Route 53 Region Region us-east-1 Region Region us-west-2
  16. Multi-region with Route 53 Amazon Route 53

  17. Latency-based routing Application Application Amazon Route 53 Region Region

  18. Geo-based routing Application Application Amazon Route 53 Region Region

  19. Weighted round robin routing Application Application Amazon Route 53 Region

    Region
  20. DNS failover Application Application Region Region Amazon Route 53

  21. Global Table Amazon DynamoDB Amazon DynamoDB Region Region Region us-east-1

    Region us-west-2
  22. Global Table AWS Lambda AWS Lambda Amazon DynamoDB Amazon DynamoDB

    Region Region Region us-east-1 Region us-west-2
  23. None
  24. https://globalddb.adhorn.me Regional API Endpoint Custom Domain Name Regional API Endpoint

    Custom Domain Name API Gateway Amazon API Gateway Amazon API Gateway AWS Lambda AWS Lambda Amazon Route 53 Region Region
  25. Route53: Traffic policy

  26. Health checks with Route 53

  27. Global Table https://global.adhorn.me AWS Lambda AWS Lambda Amazon DynamoDB Amazon

    DynamoDB Amazon API Gateway Amazon API Gateway Amazon Route 53 Region Region us-east-1 Region Region us-west-2 Voilà!
  28. © 2020, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Global Accelerator > Load Balancer > Lambda > DynamoDB
  29. Global Table AWS Lambda AWS Lambda Amazon DynamoDB Amazon DynamoDB

    AWS Global Accelerator Application Load Balancer Application Load Balancer Region Region eu-central-1 Region Region us-west-2
  30. AWS Global Accelerator

  31. None
  32. Global Table Amazon DynamoDB Amazon DynamoDB Region Region eu-central-1 Region

    Region us-west-2
  33. None
  34. Global Table AWS Lambda AWS Lambda Amazon DynamoDB Amazon DynamoDB

    Region Region eu-central-1 Region Region us-west-2
  35. None
  36. None
  37. None
  38. Global Table AWS Lambda AWS Lambda Amazon DynamoDB Amazon DynamoDB

    Application Load Balancer Application Load Balancer Region Region eu-central-1 Region Region us-west-2
  39. None
  40. None
  41. None
  42. None
  43. None
  44. Global Table AWS Lambda AWS Lambda Amazon DynamoDB Amazon DynamoDB

    AWS Global Accelerator Application Load Balancer Application Load Balancer Voilà! Region Region eu-central-1 Region Region us-west-2
  45. © 2020, Amazon Web Services, Inc. or its affiliates. All

    rights reserved.
  46. None
  47. © 2020, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. N EW - BETA
  48. N EW - BETA

  49. N EW - BETA

  50. N EW - BETA

  51. N EW - BETA

  52. N EW - BETA

  53. N EW - BETA

  54. N EW - BETA

  55. https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html N EW - BETA

  56. © 2020, Amazon Web Services, Inc. or its affiliates. All

    rights reserved.
  57. Amazon CloudFront AWS Lambda Lambda@Edge Lambda@Edge

  58. Lambda@Edge Events CloudFront cache Viewer Response Origin Response Origin Origin

    Request Viewer Viewer Request
  59. Write Once, Run Lambda Functions Globally N Virginia AWS Location

    AWS Location AWS Location AWS Location AWS Location AWS Location
  60. Lambda@Edge Programming Model exports.handler = (event, context, callback) => {

    /* viewer-request and origin-request events * have the request as input */ const request = event.Records[0].cf.request; /* viewer-response and origin-response events * have the response as input */ const response = event.Records[0].cf.response; /* Do the processing – say add a header */ /* When I am done I let CloudFront what to do next */ callback(null, request); }
  61. #awssummit Joris Andrade Software Engineer FrontApp @Zambka

  62. #awssummit Multi-region setup • Data from a customer in only

    1 region • US-West-1 ! / EU-West-1 " • Dynamic routing with DynamoDB • VPC Peering
  63. #awssummit Multi-region Setup

  64. #awssummit High Latency for global teams Customers with global teams

    experience very high latencies when their API traffic is routed to their “home” region through a different intermediate region.
  65. #awssummit Reduce latency for global teams

  66. Lambda @ Edge

  67. #awssummit Live Demo

  68. #awssummit Takeaways Great impact for our global customers : up

    to 50% latency reduction 0 0.5 1 1.5 2 2.5 AVG P50 P95 P99
  69. https://medium.com/@adhorn

  70. Thank you! © 2020, Amazon Web Services, Inc. or its

    affiliates. All rights reserved. Adrian Hornsby adhorn@amazon.com