Slide 1

Slide 1 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Danilo Poccia Principal Evangelist, Serverless @danilop Serverless Beyond Functions: Building Modern Applications

Slide 2

Slide 2 text

Photo by Joel Filipe on Unsplash Why “Modern Applications” ?

Slide 3

Slide 3 text

© 2019, Amazon Web Services, Inc. or its Affiliates. “Complexity arises when the dependencies among the elements become important.” Scott E. Page, John H. Miller Complex Adaptive Systems

Slide 4

Slide 4 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Monolithic Application Services Microservices

Slide 5

Slide 5 text

© 2019, Amazon Web Services, Inc. or its Affiliates. How Amazon SQS works Front End Back End Metadata Amazon DynamoDB Load Manager

Slide 6

Slide 6 text

© 2019, Amazon Web Services, Inc. or its Affiliates. © 2019, Amazon Web Services, Inc. or its Affiliates. “A complex system that works is invariably found to have evolved from a simple system that worked.” Gall’s Law

Slide 7

Slide 7 text

© 2019, Amazon Web Services, Inc. or its Affiliates. © 2019, Amazon Web Services, Inc. or its Affiliates. “A complex system designed from scratch never works and cannot be patched up to make it work. You have to start over with a working simple system.”

Slide 8

Slide 8 text

© 2019, Amazon Web Services, Inc. or its Affiliates. “Amazon S3 is intentionally built with a minimal feature set. The focus is on simplicity and robustness.” – Amazon S3 Press Release, March 14, 2006

Slide 9

Slide 9 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon S3 8 → more than 200 microservices Mai-Lan Tomsen Bukovec VP and GM, Amazon S3

Slide 10

Slide 10 text

© 2019, Amazon Web Services, Inc. or its Affiliates. AWS operational responsibility models On-Premises Cloud Less More Compute Virtual Machine EC2 Elastic Beanstalk AWS Lambda Fargate Databases MySQL MySQL on EC2 RDS MySQL RDS Aurora Aurora Serverless DynamoDB Storage Storage S3 Messaging ESBs Amazon MQ Kinesis SQS / SNS Analytics Hadoop Hadoop on EC2 EMR Elasticsearch Service Athena

Slide 11

Slide 11 text

© 2019, Amazon Web Services, Inc. or its Affiliates.

Slide 12

Slide 12 text

© 2019, Amazon Web Services, Inc. or its Affiliates. What is serverless? No infrastructure to manage Automatic scaling Pay for value Highly available and secure

Slide 13

Slide 13 text

© 2019, Amazon Web Services, Inc. or its Affiliates. How does Serverless work? Storage Databases Analytics Machine Learning . . . Your unique business logic User uploads a picture Customer data updated Anomaly detected API call . . . Fully-managed services Events Functions

Slide 14

Slide 14 text

© 2019, Amazon Web Services, Inc. or its Affiliates. What is an “event” ? “something that happens” Events tell us a fact Immutable time series Time What 2019 06 21 08 07 06 CustomerCreated 2019 06 21 08 07 09 OrderCreated 2019 06 21 08 07 13 PaymentSuccessful 2019 06 21 08 07 17 CustomerUpdated . . . . . .

Slide 15

Slide 15 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Time is important “Modelling events forces you to have a temporal focus on what’s going on in the system. Time becomes a crucial factor of the system.” – Greg Young, A Decade of DDD, CQRS, Event Sourcing, 2016

Slide 16

Slide 16 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Should you focus on the current status, or what is happening? Current status Domain model Commands Control ”CreateAccount” “AddProduct” What happens Domain events Event-driven Autonomy ”AccountCreated” “ProductAdded”

Slide 17

Slide 17 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Commands Vs Events Command Has an intent Directed to a target Personal communication ”CreateAccount” “AddProduct” Event It’s a fact For others to observe Broadcast one to many ”AccountCreated” “ProductAdded”

Slide 18

Slide 18 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Behavior Vs Structure “When you start modeling events, it forces you to think about the behaviour of the system. As opposed to thinking about the structure of the system.” – Greg Young, A Decade of DDD, CQRS, Event Sourcing, 2016

Slide 19

Slide 19 text

Werner Vogels, ACM QUEUE October 2008 “the storage system guarantees that if no new updates are made to the object, eventually all accesses will return the last updated value”

Slide 20

Slide 20 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Idempotency 0 0

Slide 21

Slide 21 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Idempotency 0 1 0

Slide 22

Slide 22 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Idempotency 0 1 2 3 0

Slide 23

Slide 23 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Idempotency 0 1 2 3 0 1

Slide 24

Slide 24 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Idempotency 0 1 2 3 0 1 1 1

Slide 25

Slide 25 text

© 2019, Amazon Web Services, Inc. or its Affiliates. © 2019, Amazon Web Services, Inc. or its Affiliates. How to simplify event processing? Photo by Adam Jang on Unsplash

Slide 26

Slide 26 text

© 2019, Amazon Web Services, Inc. or its Affiliates. TweetSource: Type: AWS::Serverless::Application Properties: Location: ApplicationId: arn:aws:serverlessrepo:... SemanticVersion: 2.0.0 Parameters: TweetProcessorFunctionName: !Ref MyFunction SearchText: '#serverless -filter:nativeretweets' Nested apps to simplify solving recurring problems Standard Component Custom Business Logic aws-serverless-twitter-event-source app Polling schedule (CloudWatch Events rule) trigger TwitterProcessor SearchCheckpoint TwitterSearchPoller Twitter Search API

Slide 27

Slide 27 text

© 2019, Amazon Web Services, Inc. or its Affiliates. AWS Event Fork Pipelines https://github.com/aws-samples/aws-serverless-event-fork-pipelines Amazon SNS topic Event storage & backup pipeline Event search & analytics pipeline Event replay pipeline Your event processing pipeline filtered events events to replay all events Standard Components Custom Business Logic

Slide 28

Slide 28 text

© 2019, Amazon Web Services, Inc. or its Affiliates. AWS Event Fork Pipelines – Event Storage & Backup Pipeline sns-fork-storage-backup app Amazon S3 backup bucket fan out filtered events Amazon SNS topic Amazon SQS queue AWS Lambda function

Slide 29

Slide 29 text

© 2019, Amazon Web Services, Inc. or its Affiliates. AWS Event Fork Pipelines – Event Search & Analytics Pipeline sns-fork-search-analytics app Amazon S3 dead-letter bucket fan out filtered events Amazon SNS topic Amazon SQS queue AWS Lambda function Kibana dashboard Store dead-letter events

Slide 30

Slide 30 text

© 2019, Amazon Web Services, Inc. or its Affiliates. AWS Event Fork Pipelines – Event Replay Pipeline sns-fork-message-replay app fan out filtered events Amazon SNS topic Amazon SQS replay queue AWS Lambda replay function Your regular event processing pipeline Amazon SQS processing queue enqueue events to replay Your operators enable/disable replay reprocess events…

Slide 31

Slide 31 text

© 2019, Amazon Web Services, Inc. or its Affiliates. AWS Event Fork Pipelines – E-Commerce Example

Slide 32

Slide 32 text

© 2019, Amazon Web Services, Inc. or its Affiliates. AWS Event Fork Pipelines in the Serverless Application Repository

Slide 33

Slide 33 text

Photo by J W on Unsplash Can we help more?

Slide 34

Slide 34 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon EventBridge A serverless event bus service for SaaS and AWS services • Fully managed, pay-as-you-go • Native integration with SaaS providers • 15 target services • Easily build event-driven architectures N ew

Slide 35

Slide 35 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon EventBridge Event source SaaS event bus Custom event bus Default event bus Rules AWS Lambda Amazon Kinesis AWS Step Functions Additional targets

Slide 36

Slide 36 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon EventBridge AWS services Custom events SaaS apps Event source SaaS event bus Custom event bus Default event bus Rules AWS Lambda Amazon Kinesis AWS Step Functions Additional targets "detail-type": "source": "aws.partner/example.com/123", "detail": "ticketId": "department": "creator":

Slide 37

Slide 37 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon EventBridge AWS services Custom events SaaS apps Event source SaaS event bus Custom event bus Default event bus Rules AWS Lambda Amazon Kinesis AWS Step Functions Additional targets "detail-type": "source": "aws.partner/example.com/123" "detail": "ticketId": "department": "creator": "source":

Slide 38

Slide 38 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon EventBridge AWS services Custom events SaaS apps Event source SaaS event bus Custom event bus Default event bus Rules AWS Lambda Amazon Kinesis AWS Step Functions Additional targets "detail-type": "source": "aws.partner/example.com/123", "detail": "ticketId": "department": "billing" "creator": "detail": "department": ["billing", "fulfillment"]

Slide 39

Slide 39 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon EventBridge AWS services Custom events SaaS apps Event source SaaS event bus Custom event bus Default event bus Rules AWS Lambda Amazon Kinesis AWS Step Functions Additional targets "detail-type": "Ticket Created" "source": "aws.partner/example.com/123", "detail": "ticketId": "department": "billing", "creator": "detail-type": ["Ticket Resolved"]

Slide 40

Slide 40 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Amazon EventBridge integration partners

Slide 41

Slide 41 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Common use cases

Slide 42

Slide 42 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Common use cases

Slide 43

Slide 43 text

© 2019, Amazon Web Services, Inc. or its Affiliates. © 2019, Amazon Web Services, Inc. or its Affiliates. What about teams? Photo by Perry Grone on Unsplash

Slide 44

Slide 44 text

© 2019, Amazon Web Services, Inc. or its Affiliates. You Build It, You Run It “This brings developers into contact with the day-to-day operation of their software. It also brings them into day-to- day contact with the customer.” – Werner Vogels CTO, Amazon.com

Slide 45

Slide 45 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Team size & communication paths = ( − 1) 2 Communication paths in a team of N people

Slide 46

Slide 46 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Two pizza teams Photo by Kristina Bratko on Unsplash

Slide 47

Slide 47 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Separable vs complex tasks Separable task Complex task

Slide 48

Slide 48 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Ability as a collection of cognitive tools Adam Abilities = 5 { A, B, C, D, E } For example: A – mobile development on iOS B – back end development in Java C – data analytics in Python D – complex SQL queries E – …

Slide 49

Slide 49 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Ability as a collection of cognitive tools Adam Carl Betsy { C, D, G } Abilities = 5 Abilities = 4 Abilities = 3 { A, B, E, F } { A, B, C, D, E }

Slide 50

Slide 50 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Diversity bonus model – Team with best abilities Adam Carl Betsy { C, D, G } Abilities = 5 Abilities = 4 Abilities = 3 Team Abilities = 6 { A, B, E, F } { A, B, C, D, E }

Slide 51

Slide 51 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Diversity bonus model – Team with more cognitive tools Adam Carl Betsy { A, B, E, F } { A, B, C, D, E } { C, D, G } Abilities = 5 Abilities = 4 Abilities = 3 Team Abilities = 7

Slide 52

Slide 52 text

© 2019, Amazon Web Services, Inc. or its Affiliates. No diversity, no bonus – Beware hiring managers Adam Carl Betsy { A, B, C, D } { A, B, C, D, E } { B, C, D } Abilities = 5 Abilities = 4 Abilities = 3

Slide 53

Slide 53 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Some cognitive tools must be learned in order Adam Carl Betsy { A, B, C, D } { A, B, C, D, E } { A, B, C } Abilities = 5 Abilities = 4 Abilities = 3

Slide 54

Slide 54 text

© 2019, Amazon Web Services, Inc. or its Affiliates. 2,092 people who worked on 474 musicals from 1945 to 1989 Small world networks & creativity AJS Volume 111 Number 2 (September 2005): 000–000 PROOF 1 ᭧ 2005 by The University of Chicago. All rights reserved. 0002-9602/2005/11102-0003$10.00 Thursday Oct 13 2005 11:31 AM AJS v111n2 090090 VSJ Collaboration and Creativity: The Small World Problem1 Brian Uzzi Northwestern University Jarrett Spiro Stanford University Small world networks have received disproportionate notice in di- verse fields because of their suspected effect on system dynamics. The authors analyzed the small world network of the creative artists who made Broadway musicals from 1945 to 1989. Based on original arguments, new statistical methods, and tests of construct validity, they found that the varying “small world” properties of the systemic- level network of these artists affected their creativity in terms of the financial and artistic performance of the musicals they produced. The small world network effect was parabolic; performance in- creased up to a threshold after which point the positive effects reversed. Creativity aids problem solving, innovation, and aesthetics, yet our un- derstanding of it is still forming. We know that creativity is spurred when diverse ideas are united or when creative material in one domain inspires or forces fresh thinking in another. These structural preconditions suggest 1 Our thanks go out to Duncan Watts; Huggy Rao; Peter Murmann; Ron Burt; Matt Bothner; Frank Dobbin; Bruce Kogut; Lee Fleming; David Stark; John Padgett; Dan Diermeier; Stuart Oken; Jerry Davis; Woody Powell; workshop participants at the University of Chicago, University of California at Los Angeles, Harvard, Cornell, New York University, the Northwestern University Institute for Complex Organizations (NICO); and the excellent AJS reviewers, especially the reviewer who provided a remarkable 15, single-spaced pages of superb commentary. We particularly wish to thank Mark Newman for his advice and help in developing and interpreting the bipartite-affiliation network statistics. We also wish to give very special thanks to the Santa Fe Institute for creating a rich collaborative environment wherein these ideas first emerged, and to John Padgett, the organizer of the States and Markets group at the Santa Fe Institute. Direct correspondence to Brian Uzzi, Kellog School of Man- agement, Northwestern University, Evanston, Illinois 60208. E-mail: [email protected]

Slide 55

Slide 55 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Photo by Scott Blake on Unsplash What can we build?

Slide 56

Slide 56 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Capital One – Credit Offers API serverless architecture Affiliates www.capitalone.com/ credit-cards/prequalify AWS Cloud Capital One API Gateway VPC Lambda Function Traces Logs Production Support Command Center COAT Credit Offers API Team Lambda Function S3 Bucket TTL Third-Party API Case Study

Slide 57

Slide 57 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Capital One – Credit Offers API CI/CD pipeline Continuous Improvement, Continuous Delivery! GitHub LGTM Bot Jenkins AWS SAM S3 Bucket (Versioning) Lambda Function DeploymentType: dev: AllAtOnce qa: AllAtOnce qaw: AllAtOnce prod: Canary10Percent10Minutes prodw: Canary10Percent10Minutes canary5xxGetProductsAlarm: Type: AWS::CloudFormation::Alarm Properties: AlarmActions: - !FindInMap: - params - AdminSNSTopic - !Ref Environment AlarmDescription: 500 error from product listing Lambda. ComparisonOperator: GreatherThanOrEqualTothreshold Period: 300 Statistic: Sum Threshold: 1 EvaluationPeriod: 1 Case Study

Slide 58

Slide 58 text

© 2019, Amazon Web Services, Inc. or its Affiliates. Capital One – Benefits from taking the API serverless Performance gains From the time the request is received by lambda to the time to send the response back 70% Cost savings By removing EC2, ELB and RDS from our solution 90% Increase in team velocity Reduce investment in team’s time on DevOps and dedicate back to feature development! 30% Case Study

Slide 59

Slide 59 text

SCALING CHALLENGES 350 DONATIONS PER SECOND Case Study

Slide 60

Slide 60 text

OLD VS NEW March 2019 cost* $5,393 March 2015 cost* $83,908 *All hosting costs are paid for through corporate partnerships. 100% of public donations go to the projects we fund. Case Study

Slide 61

Slide 61 text

WE COULD DO IT ALL AGAIN TOMORROW Serverless services cost $92 Case Study

Slide 62

Slide 62 text

© 2019, Amazon Web Services, Inc. or its Affiliates. • Enable experimentation • Componentize applications • Update applications and infrastructure quickly • Model and provision application resources • Simplify infrastructure management • Improve application performance • Secure the entire application lifecycle Best practices for modern application development • Enable experimentation by creating a culture of ownership • Componentize applications using microservices • Update applications and infrastructure quickly by automating the release pipeline • Model and provision application resources using infrastructure as code • Simplify infrastructure management with serverless technologies • Improve application performance by increasing observability • Secure the entire application lifecycle by automating security

Slide 63

Slide 63 text

© 2019, Amazon Web Services, Inc. or its Affiliates. © 2019, Amazon Web Services, Inc. or its Affiliates. Thank you! @danilop