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

Evolutionary Serverless Architectures with Safe Deployments

Evolutionary Serverless Architectures with Safe Deployments

ServerlessDays, Milan, October 19th, 2018

The term "architecture" applied to software can bring the idea of static, difficult to change, solutions. Unfortunately, that is often the result of a software implementation.

An evolutionary architecture designs for incremental change in an architecture as a first principle, looking at software development over time as an optimization task, using a "fitness function" to estimate the efficiency of a software release.

In this session, we’ll show how to automate a CI/CD pipeline to compute a fitness function during deployment, using a pre-traffic hook Lambda function dynamically analyzing the configuration of the resources implemented via AWS Serverless Application Model (SAM) templates.

Danilo Poccia

October 19, 2018
Tweet

More Decks by Danilo Poccia

Other Decks in Programming

Transcript

  1. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Danilo Poccia, Principal Evangelist, Serverless
    Evolutionary Serverless Architectures
    with Safe Deployments
    @danilop
    danilop
    October 18th, 2018

    View full-size slide

  2. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Photo by Oskars Sylwan on Unsplash
    Focus on what you want to build,
    not the nuts & bolts required
    by the implementation of the solution

    View full-size slide

  3. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Development Equilibrium
    Unique Features
    to Build
    Comfort Zone
    of Known Issues

    View full-size slide

  4. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    PhotoVogue Case Study
    “IT is no longer holding back the business.
    In fact, it’s helping us grow faster”
    — Marco Viganò, Digital CTO, Condé Nast Italia

    View full-size slide

  5. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Photo by Samuele Errico Piccarini on Unsplash

    View full-size slide

  6. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Gain Speed & Control
    Project Product

    View full-size slide

  7. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    “An evolutionary architecture designs
    for incremental change in an architecture
    as a first principle.”
    — Rebecca Parsons, CTO,
    Neal Ford, Meme Wrangler,
    ThoughtWorks

    View full-size slide

  8. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    “Incremental change is your first requirement.”
    — Me

    View full-size slide

  9. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Product Target

    View full-size slide

  10. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Product
    New Features
    Refactoring
    Improve Security
    Improve Scalability
    Target
    ?
    ?
    This is an Optimization Problem…

    View full-size slide

  11. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Best Solution
    (Unknown)
    This is an Optimization Problem…

    View full-size slide

  12. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Best Solution
    (Unknown)
    How to Explore the Space of All Possible Solutions?

    View full-size slide

  13. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Evolutionary Algorithms
    Best Solution
    (Unknown)
    Candidate
    Solutions

    View full-size slide

  14. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Evolutionary Algorithms
    Best Solution
    (Unknown)
    Candidate
    Solutions
    Fitness
    Function

    View full-size slide

  15. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Evolutionary Algorithms
    Best Solution
    (Unknown)
    Candidate
    Solutions
    Fitness
    Function

    View full-size slide

  16. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Evolutionary Algorithms
    Best Solution
    (Unknown)
    Fitness
    Function
    Candidate
    Solutions

    View full-size slide

  17. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Evolutionary Algorithms
    Candidate
    Solutions
    Best Solution
    (Unknown)
    Fitness
    Function
    Generation
    Selection

    View full-size slide

  18. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Photo by Eliecer Gallegos on Unsplash
    It’s not easy to explore
    all possible software architectures…
    …but we can measure them!

    View full-size slide

  19. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    + Source Code Metrics
    + Tests Coverage
    + Performance Metrics
    + Encryption Checks
    + Credential Rotation Checks
    + …

    View full-size slide

  20. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    + Source Code Metrics
    + Tests Coverage
    + Performance Metrics
    + Encryption Checks
    + Credential Rotation Checks
    + …
    = Fitness Function

    View full-size slide

  21. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Fitness Function
    Best Solution
    (Unknown)
    Should I go here?
    Current
    Architecture
    Or there?
    How good the current
    architecture is?
    How much would
    improve if …
    Functional
    Requirement
    Non-Functional
    Requirement

    View full-size slide

  22. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Fitness Function
    fitness
    time
    Improved
    Scalability
    Encryption
    In Transit
    Increased
    Availability
    Encryption
    At Rest
    First
    Release
    v1 v2 v3 v4 v5

    View full-size slide

  23. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Photo by G. Crescoli on Unsplash
    Mmmmm…
    Something similar?

    View full-size slide

  24. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Objective Function (Machine Learning)
    Objective
    Function
    Loss Regularization
    How predictive
    the model is
    on the data
    How complex
    the model is
    (to avoid overfitting)
    Objective
    is to minimize
    = +

    View full-size slide

  25. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Fitness Function & Complexity
    Fitness
    Function
    Fitness Regularization
    How good
    the architecture is
    How complex
    the architecture is
    Change sign
    to maximize
    = +

    View full-size slide

  26. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Serverless Architectures
    Code
    Stack
    Package Deploy
    Template
    Feedback

    View full-size slide

  27. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Serverless Architectures
    Stack
    Deploy

    View full-size slide

  28. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Serverless Architectures
    Deploy Stack

    View full-size slide

  29. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Serverless Architectures
    All At Once
    Canary Deployment
    Linear Deployment
    Deploy
    Hooks
    Alarms
    PreTraffic Function
    PostTraffic Function
    Stack

    View full-size slide

  30. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Hooks
    Hooks
    Serverless Architectures
    PreTraffic Function
    PostTraffic Function

    View full-size slide

  31. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    PreTraffic & PostTraffic Functions
    Hooks
    List Stack Resources
    Check Non-Functional Requirements
    Config Rules
    Source Code Metrics
    Performance Metrics
    PreTraffic Function
    PostTraffic Function

    View full-size slide

  32. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    PreTraffic & PostTraffic Functions
    ü check that encryption at rest is enabled on all S3 buckets
    ü check that versioning is enabled on all S3 buckets
    ü check that encryption at rest is enabled on all DynamoDB tables
    ü check that public write and/or read is prohibited for all S3 buckets
    ü check that S3 buckets accept HTTPS requests only
    ü check that auto scaling is enabled for all DynamoDB tables
    Check Non-Functional Requirements

    View full-size slide

  33. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    PreTraffic & PostTraffic Functions
    ü s3-bucket-logging-enabled
    ü s3-bucket-replication-enabled
    ü s3-bucket-versioning-enabled
    ü s3-bucket-public-write-prohibited
    ü s3-bucket-public-read-prohibited
    ü s3-bucket-ssl-requests-only
    ü s3-bucket-server-side-encryption-enabled
    ü dynamodb-autoscaling-enabled
    ü dynamodb-throughput-limit-check
    ü lambda-function-public-access-prohibited
    ü lambda-function-settings-check
    Config Rules

    View full-size slide

  34. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Hooks
    PreTraffic & PostTraffic Functions
    Update Product Dashboard
    PreTraffic Function
    PostTraffic Function
    Publish Custom Metric
    Analyze Architecture

    View full-size slide

  35. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Product Dashboard
    fitness
    time
    Improved
    Scalability
    Encryption
    In Transit
    Increased
    Availability
    Encryption
    At Rest
    First
    Release
    v1 v2 v3 v4 v5
    Back End
    Latency
    Concurrent
    Users
    Sales
    Per Minute
    Catalog Searches
    Per Minute
    Your Top
    Business Metric
    Fitness
    Function

    View full-size slide

  36. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Photo by Kea Mowat on Unsplash

    View full-size slide

  37. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Demo

    View full-size slide

  38. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    https://github.com/danilop/evolutionary-serverless-architectures-with-safe-deployments

    View full-size slide

  39. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Thank you!
    @danilop
    danilop

    View full-size slide