Slide 1

Slide 1 text

Mobile Scale Web Applications using Amazon Web Services! Ben Whaley @iAmTheWhaley!

Slide 2

Slide 2 text

Mobile scale! 3.5-4 billion mobile phones! vs ~1.8 billion PCs!

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Mobile scale! Weeks of product development, not months or years!

Slide 5

Slide 5 text

Mobile scale! ~1.2 million apps each in the Apple App Store and Google Play!

Slide 6

Slide 6 text

Mobile scale! 1-5 trillion photos taken in 2014 ! vs  ~80  billion  in  1999  

Slide 7

Slide 7 text

Mobile scale! Impact of Internet of Things still TBD!

Slide 8

Slide 8 text

“Smartphones liberate the internet from the browser in the same way that the browser liberated it from the command line”! ! !! ! !!- Benedict Evans!

Slide 9

Slide 9 text

Mature mobile platforms! •  Use the cloud to enable rich native apps! •  Blur the line between apps and the web! •  Hyperlocal via iBeacons & NFC! •  “Mobile” is no longer “smartphone”! – Car tech! – Watches! – TV! – Google glass!

Slide 10

Slide 10 text

Mobile is powered by APIs
 
 
 (APIs live in the cloud)!

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Key Business Drivers! •  API-driven interfaces! •  Data pipelines for business analytics! •  Improved availability! •  Elasticity for ! – Cost savings! – Capacity on demand! •  Focus on core competencies!

Slide 16

Slide 16 text

Designing for Mobile Scale, in Four Parts!

Slide 17

Slide 17 text

Part I: Network!

Slide 18

Slide 18 text

The Foundation! •  The first ubiquitous SDN! •  Create and configure via! –  Console! –  API! –  CloudFormation! •  Key features include:! –  Custom route tables! –  Public and private subnets! –  Security groups! –  Network ACLs! –  Native support for many AWS services! –  VPN Gateways! –  Intra-region peering! !

Slide 19

Slide 19 text

Infrastructure VPC Subnet Design Public web Private Services Persistence 10.0.2.0/24 10.0.1.0/24 10.0.0.0/24 10.0.12.0/24 10.0.11.0/24 10.0.10.0/24 10.0.22.0/24 10.0.21.0/24 10.0.20.0/24 10.0.32.0/24 10.0.31.0/24 10.0.30.0/24 Availability Zone A Availability Zone B Availability Zone C us-east-1 10.0.0.0/16 Infrastructure VPC Subnet Design Public web Private Services Persistence 10.0.2.0/24 10.0.1.0/24 10.0.0.0/24 10.0.12.0/24 10.0.11.0/24 10.0.10.0/24 10.0.22.0/24 10.0.21.0/24 10.0.20.0/24 10.0.32.0/24 10.0.31.0/24 10.0.30.0/24 Availability Zone A Availability Zone B Availability Zone C us-east-1 10.0.0.0/16

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

us-east-1 10.0.0.0/16 Application A us-east-1 10.1.0.0/16 Application B Micronets!

Slide 25

Slide 25 text

us-east-1 10.0.0.0/16 Development us-east-1 10.10.0.0/16 Test us-east-1 10.20.0.0/16 Staging us-east-1 10.30.0.0/16 Production Environment Separation!

Slide 26

Slide 26 text

us-east-1 10.0.0.0/16 Application A eu-west-1 10.10.0.0/16 Application A us-west-2 10.20.0.0/16 Application A ap-southeast-1 10.30.0.0/16 Application A Cross-region VPCs! VPN Gateway! or! Direct Connect!

Slide 27

Slide 27 text

•  Principle of Least Privilege realized! •  Use a private subnets when inbound connections are not required! •  Reduces overall Internet-facing footprint! •  Per application security groups! •  Allow access by group, not CIDR! •  Separate cross-subnet access using ACLs! VPC Security Benefits!

Slide 28

Slide 28 text

•  Intra-zone: < 1ms! •  Intra-region: < 5ms! •  Between VPCs: < 5ms, with SSL +20-40ms! •  us-west-2 – us-east-1: ~100ms! •  us-east-1 – eu-west-1: ~100ms! •  us-east-1 – ap-southeast-1: ~250ms! Latency Considerations!

Slide 29

Slide 29 text

Part II: Systems!

Slide 30

Slide 30 text

“Construct a highly agile and highly available service from ephemeral and often broken components”! ! ! !! !- Adrian Cockcroft! ! ! “The simpler, the better. Complications lead to multiplicative chains of unanticipated effects.”! ! - Nassim Nicholas Taleb, Antifragile!

Slide 31

Slide 31 text

AWS System Design! •  n+2 redundancy! n n+1 n+2

Slide 32

Slide 32 text

AWS System Design! •  n+2 redundancy! •  Compute resources are ephemeral! n n+1 n+2 n+3 n+4 n+5

Slide 33

Slide 33 text

AWS System Design! •  n+2 redundancy! •  Compute resources are ephemeral! •  Infrastructure captured as code! "Resources" : {! "Ec2Instance" : {! "Type" : "AWS::EC2::Instance", ! "Properties" : {! "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, "PV64" ]},! "KeyName" : { "Ref" : "KeyName" },! "InstanceType" : "m1.small",! "SecurityGroups" : [{ "Ref" : "Ec2SecurityGroup" }],! "BlockDeviceMappings" : [! {! "DeviceName" : "/dev/sdc",! "VirtualName" : "ephemeral0"! }! ]! }! },!

Slide 34

Slide 34 text

AWS System Design! •  n+2 redundancy! •  Compute resources are ephemeral! •  Infrastructure captured as code! •  Minimalist operating system!

Slide 35

Slide 35 text

AWS System Design! •  n+2 redundancy! •  Compute resources are ephemeral! •  Infrastructure captured as code! •  Minimalist operating system! •  Databases are multi-AZ w/ provisioned IOPS! •  Use read replicas when possible!

Slide 36

Slide 36 text

AWS System Design! •  n+2 redundancy! •  Compute resources are ephemeral! •  Infrastructure captured as code! •  Minimalist operating system! •  Databases are multi-AZ w/ provisioned IOPS! •  Use read replicas when possible! •  Who needs internal DNS?!

Slide 37

Slide 37 text

AWS System Design! •  n+2 redundancy! •  Compute resources are ephemeral! •  Infrastructure captured as code! •  Minimalist operating system! •  Databases are multi-AZ w/ provisioned IOPS! •  Use read replicas when possible! •  Who needs internal DNS?! •  Tag all the things!

Slide 38

Slide 38 text

How baked should you be?! Config  managed  instances   Fully  baked  AMI   Most  users  needs  

Slide 39

Slide 39 text

•  Reserved instances! •  Choosing correct instance types:! •  Default to T2 for development, small web services! •  General purpose M3! •  C3 for heavy compute needs! •  R3 for memory intensive apps! •  Use autoscale groups with appropriate triggers and minimums! Cost Optimizations!

Slide 40

Slide 40 text

Part III: Applications!

Slide 41

Slide 41 text

•  Stateless processes! Cloud Native Application Design! Database App  Server   App  Server  

Slide 42

Slide 42 text

•  Stateless processes! •  Loose coupling among services! Cloud Native Application Design! Service  1   Service  2   Service  3   Queue   Queue  

Slide 43

Slide 43 text

•  Stateless processes! •  Loose coupling among services! •  Deep instrumentation! Cloud Native Application Design!

Slide 44

Slide 44 text

•  Stateless processes! •  Loose coupling among services! •  Deep instrumentation! •  Keep configuration in the environment! Cloud Native Application Design!

Slide 45

Slide 45 text

•  Implementation is not complete until there are unit tests! Cloud Native Application Design!

Slide 46

Slide 46 text

•  Stateless processes! •  Loose coupling among services! •  Deep instrumentation! •  Keep configuration in the environment! •  Implementation is not complete until there are unit tests! •  Open source by default! Cloud Native Application Design!

Slide 47

Slide 47 text

Embracing AWS Services! •  SQS vs AMQP! •  RDS vs on-instance Postgres or MySQL! •  Redshift vs custom data warehouse! •  Elasticache vs on-instance Redis or memcached! •  EMR vs custom Hadoop! •  DynamoDB vs on-instance NoSQL!

Slide 48

Slide 48 text

Part IV: Delivery!

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

Commit! Build! Test! Deploy!

Slide 51

Slide 51 text

Simplified Git Flow! Master   Develop   Feature  1   Feature  2  

Slide 52

Slide 52 text

•  Automatically run feature branches in the cloud! Personal Builds! personal.example.com Build server Commit to remote-run branch

Slide 53

Slide 53 text

•  On-demand integration environment using Docker containers! Integration Testing! Build server 1. Get  dependencies   2. Run  unit  tests   3. Build     4. Start  containers   5. Run  integraKon  tests  using   containers  as    resources  

Slide 54

Slide 54 text

Build Artifact!

Slide 55

Slide 55 text

Deployment Approaches!

Slide 56

Slide 56 text

www.example.com! Live Code! Blue/Green!

Slide 57

Slide 57 text

www.example.com! Live Code! New Code! Blue/Green!

Slide 58

Slide 58 text

www.example.com! Live Code! Rolling Release!

Slide 59

Slide 59 text

www.example.com! New! Old! Old! Old! Rolling Release!

Slide 60

Slide 60 text

www.example.com! New! New! Old! Old! Rolling Release!

Slide 61

Slide 61 text

www.example.com! New! New! New! Rolling Release!

Slide 62

Slide 62 text

www.example.com! Hybrid! Live! Live! Live!

Slide 63

Slide 63 text

Live! Live! Live! New! New! New! www.example.com! Hybrid!

Slide 64

Slide 64 text

www.example.com! Hybrid! New! New! New!

Slide 65

Slide 65 text

Part I: Network
 Part II: Systems
 Part II: Applications
 Part IV: Delivery!

Slide 66

Slide 66 text

“And that’s all I have to say about that.”! - Forrest Gump!

Slide 67

Slide 67 text

Ben Whaley! ! bwhaley.com! @iAmTheWhaley!