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

Serverless beyond Functions: Building Modern Applications

Serverless beyond Functions: Building Modern Applications

AWS Community Day, Chennai, August 10th, 2019

Modern application development is an approach to designing, building, and managing applications. This approach increases the agility of your teams and the reliability, security, and scalability of your applications. Through modern application development, you can build better products faster so you can have happier customers. Serverless enables you to build modern applications with increased agility and lower total cost of ownership. Building serverless applications means that your developers can focus on their core product instead of worrying about managing and operating servers or runtimes, either in the cloud or on-premises. This reduced overhead lets developers reclaim time and energy that can be spent on developing great products which scale and that are reliable.

Danilo Poccia

August 10, 2019
Tweet

More Decks by Danilo Poccia

Other Decks in Programming

Transcript

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

    View Slide

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

    View Slide

  3. © 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

    View Slide

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

    View Slide

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

    View Slide

  6. © 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

    View Slide

  7. © 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.”

    View Slide

  8. © 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

    View Slide

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

    View Slide

  10. © 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

    View Slide

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

    View Slide

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

    View Slide

  13. © 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

    View Slide

  14. © 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
    . . . . . .

    View Slide

  15. © 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

    View Slide

  16. © 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”

    View Slide

  17. © 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”

    View Slide

  18. © 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

    View Slide

  19. 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”

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  25. © 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

    View Slide

  26. © 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

    View Slide

  27. © 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

    View Slide

  28. © 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

    View Slide

  29. © 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

    View Slide

  30. © 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…

    View Slide

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

    View Slide

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

    View Slide

  33. Photo by J W on Unsplash
    Can we help more?

    View Slide

  34. © 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

    View Slide

  35. © 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

    View Slide

  36. © 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":

    View Slide

  37. © 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":

    View Slide

  38. © 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"]

    View Slide

  39. © 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"]

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  43. © 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

    View Slide

  44. © 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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  48. © 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 – …

    View Slide

  49. © 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 }

    View Slide

  50. © 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 }

    View Slide

  51. © 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

    View Slide

  52. © 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

    View Slide

  53. © 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

    View Slide

  54. © 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]

    View Slide

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

    View Slide

  56. © 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

    View Slide

  57. © 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

    View Slide

  58. © 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

    View Slide

  59. SCALING CHALLENGES
    350
    DONATIONS PER SECOND
    Case
    Study

    View Slide

  60. 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

    View Slide

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

    View Slide

  62. © 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

    View Slide

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

    View Slide