Slide 1

Slide 1 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Adrian Hornsby, Cloud Architecture Evangelist @adhorn Building Global, Multi-Region Serverless Backends (powered by DynamoDB Global Tables)

Slide 2

Slide 2 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Failures are a given and everything will eventually fail over time. Werner Vogels CTO – Amazon.com “ “

Slide 3

Slide 3 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. System failure rate Early Failures Wear Out Failures Observed Failures Random Failures

Slide 4

Slide 4 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. System failure rate For high-velocity deployments Early Failures Wear Out Failures Observed Failures Random Failures

Slide 5

Slide 5 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. … at the Edge

Slide 6

Slide 6 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. System Availability Availability = Normal Operation Time Total Time MTBF** MTBF** + MTTR* = * Mean Time To Repair (MTTR) **Mean Time Between Failure (MTBF)

Slide 7

Slide 7 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Availability Availability Downtime per year Categories 95% (1-nine) 18 days 6 hours Batch processing, Data extraction, Load jobs. 99% (2-nines) 3 days 15 hours Internal Tools, Project Tracking 99.9% (3-nines) 8 hours 45 minutes Online Commerce 99.99% (4-nines) 52 minutes Video Delivery, Broadcast systems 99.999% (5-nines) 5 minutes Telecom Industry (ATM Transactions) 99.9999% (6-nines) 31 seconds Answering to my loved one* * Joke J http://royal.pingdom.com/wp-content/uploads/2015/04/pingdom_uptime_cheat_sheet.pdf

Slide 8

Slide 8 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Availability in Series Part X Part Y A = Ax Ay

Slide 9

Slide 9 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Availability in Series Component Availability Downtime X 99% (2-nines) 3 days 15 hours Y 99.99% (4-nines) 52 minutes X and Y Combined 98.99% 3 days 16 hours 33 minutes

Slide 10

Slide 10 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Availability in Parallel A = 1 – (1 – Ax)2 Part X Part X

Slide 11

Slide 11 text

© 2017, 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

Slide 12

Slide 12 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. “Component redundancy increases availability significantly!”

Slide 13

Slide 13 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Availability Zone A Availability Zone B Availability Zone C AWS Region

Slide 14

Slide 14 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Availability Zone A Availability Zone B Availability Zone C Multi-AZ Well-Architected Application

Slide 15

Slide 15 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DynamoDB Amazon RDS Amazon ElastiCache Amazon S3 Amazon EFS Amazon SQS Amazon Kinesis Amazon ElasticSearch Default Configurable for multi-AZ deployment Some of the Regional AWS Services AWS Lambda Amazon API Gateway AWS ELB

Slide 16

Slide 16 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Regional services AZ1 AZ2 AZ3 Service XYZ

Slide 17

Slide 17 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. No servers to provision or manage Scales with usage Never pay for idle Availability and fault tolerance built in Why Serverless components??

Slide 18

Slide 18 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • 18 Geographic Regions • 55 Availability Zones (AZs) • 4 regions and 12 more Availability Zones announced

Slide 19

Slide 19 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Cost of Availability (approx.) Cost Availability Complexity

Slide 20

Slide 20 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Generally speaking a reliable machine has high availability but an available machine may or may not be very reliable.

Slide 21

Slide 21 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. On reliability Ability of a system to : 1. Recover from infrastructure or service disruptions 2. Dynamically acquire computing resources to meet demand 3. Mitigate disruptions such as misconfigurations or transient network issues.

Slide 22

Slide 22 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Why build a Multi-Region Active-Active architecture?

Slide 23

Slide 23 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Why Multi-Region? 1. Improve Latency for end-users ~300ms ~140ms

Slide 24

Slide 24 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Why Multi-Region? 1. Improve Latency for end-users 2. 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

Slide 25

Slide 25 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Why Multi-Region? 1. Improve Latency for end-users 2. Disaster Recovery 3. Business Requirements

Slide 26

Slide 26 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Netflix 2013

Slide 27

Slide 27 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Netflix 2016

Slide 28

Slide 28 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Chaos Engineering

Slide 29

Slide 29 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. How to build a Multi-Region Architecture on AWS.

Slide 30

Slide 30 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Data Replication Component A Component B Component C Latency < 5 ms Synchronous Asynchronous Latency > 5 ms

Slide 31

Slide 31 text

© 2017, 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!

Slide 32

Slide 32 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 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.

Slide 33

Slide 33 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Process A Process B Process A Process B Synchronous Asynchronous Waiting Working Continues get or fetch result Get result

Slide 34

Slide 34 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Reliable & Secure Network AWS Region A AWS Region B Amazon Global Network

Slide 35

Slide 35 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. James Hamilton – 2016 re:Invent Vice President & Distinguished Engineer

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Multi-Region Multi-VPC Connectivity

Slide 39

Slide 39 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. S3 - Cross-Region Replication

Slide 40

Slide 40 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Cross-Region Read Replicas for Amazon RDS ** For Aurora, MySQL, MariaDB and PostgreSQL engines.

Slide 41

Slide 41 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. “Simple” Cross-Region Usage Pattern • Regional Reads • All critical writes traffic to a single master

Slide 42

Slide 42 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Aurora multi-master - scale out reads & writes First MySQL compatible DB service with scale-out across multiple data centers Zero application downtime from ANY instance failure Zero application downtime from ANY AZ failure Faster write performance and higher scale Sign up for single-region multi-master preview today; Multi-Region Multi-Master coming in 2018 Availability Zone 1 Scale out both reads and writes Availability Zone 2 Availability Zone 3 Application Read/Write Master 1 Shared distributed storage volume Read/Write Master 2 Read/Write Master 3

Slide 43

Slide 43 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DynamoDB Fast and flexible NoSQL database service for any scale Fast, consistent performance Highly scalable Fully managed Business critical reliability Consistent single-digit millisecond latency; DAX in-memory performance reduces response times to microseconds Auto-scaling to hundreds of terabytes of data that serve millions of requests per second Automatic provisioning, infrastructure management, scaling, and configuration with zero downtime Data is replicated across fault tolerant Availability Zones, with fine-grained access control The image part with relationshi p ID rId3 was not found in the file.

Slide 44

Slide 44 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Prime Day 2017 Metrics Block Storage – Use of Amazon Elastic Block Store (EBS) grew by 40% year-over-year, with aggregate data transfer jumping to 52 petabytes (a 50% increase) for the day and total I/O requests rising to 835 million (a 30% increase). NoSQL Database – Amazon DynamoDB requests from Alexa, the Amazon.com sites, and the Amazon fulfillment centers totaled 3.34 trillion, peaking at 12.9 million per second. Stack Creation – Nearly 31,000 AWS CloudFormation stacks were created for Prime Day in order to bring additional AWS resources on line. API Usage – AWS CloudTrail processed over 50 billion events and tracked more than 419 billion, all in support of Prime Day. Configuration Tracking – AWS Config generated over 14 million Configuration items for AWS resources.

Slide 45

Slide 45 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DynamoDB Global Tables (GA) First fully managed, multi-master, multi-region database 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

Slide 46

Slide 46 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DynamoDB Streams • Each stream record appears exactly once in the stream. • For each item that is modified in a DynamoDB table, the stream records appear in the same sequence as the actual modifications to the item Amazon DynamoDB AWS Lambda Streams

Slide 47

Slide 47 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Route 53 • AWS’s Authoritative Domain Name Service. • Highly available and scalable. • Supports Traffic Flow through a variety of routing, all of which can be combined with DNS Failover. • Enable a variety of low-latency, fault-tolerant architectures.

Slide 48

Slide 48 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Traffic Routing with Route53 1. Latency Based Routing Amazon Route53 Resource A Resource B 137ms latency 76ms latency

Slide 49

Slide 49 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Traffic Routing with Route53 1. Latency Based Routing 2. Geo DNS Amazon Route53 Resource A In US Resource B in EU User in US

Slide 50

Slide 50 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Traffic Routing with Route53 1. Latency Based Routing 2. Geo DNS 3. Weighted Round Robin Amazon Route53 Resource A In US Resource B in EU

Slide 51

Slide 51 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Traffic Routing with Route53 1. Latency Based Routing 2. Geo DNS 3. Weighted Round Robin 4. DNS Failover Amazon Route53 Resource A In US Resource B in EU User in US

Slide 52

Slide 52 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Hands-on Demo: Building Multi-Region Serverless Application

Slide 53

Slide 53 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DynamoDB AWS Lambda Amazon API Gateway Amazon DynamoDB AWS Lambda Amazon API Gateway Amazon Route53 eu-west-1 us-east-1 Global Tables https://globalddb.adhorn.me/

Slide 54

Slide 54 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DynamoDB Amazon DynamoDB eu-west-1 us-east-1 Global Tables

Slide 55

Slide 55 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Slide 56

Slide 56 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Slide 57

Slide 57 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Slide 58

Slide 58 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Slide 59

Slide 59 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Slide 60

Slide 60 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DynamoDB AWS Lambda Amazon DynamoDB AWS Lambda eu-west-1 us-east-1 Global Tables

Slide 61

Slide 61 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Lambda Function

Slide 62

Slide 62 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DynamoDB AWS Lambda Amazon API Gateway Amazon DynamoDB AWS Lambda Amazon API Gateway eu-west-1 us-east-1 Global Tables

Slide 63

Slide 63 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. us-west-2 us-east-1 Client Amazon Route 53 Regional API Endpoint Regional API Endpoint Custom Domain Name Custom Domain Name API Gateway API Gateway Lambda Lambda globalddb.adhorn.me CNAME CNAM E Multi-Region with API Gateway

Slide 64

Slide 64 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Route53: Traffic Policy

Slide 65

Slide 65 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DynamoDB AWS Lambda Amazon API Gateway Amazon DynamoDB AWS Lambda Amazon API Gateway Amazon Route53 eu-west-1 us-east-1 Global Tables https://globalddb.adhorn.me/

Slide 66

Slide 66 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. https://medium.com/@adhorn

Slide 67

Slide 67 text

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Thanks you! @adhorn #BuildOnAWS https://medium.com/@adhorn