$30 off During Our Annual Pro Sale. View Details »

What Can You Do with Serverless – In 2021

What Can You Do with Serverless – In 2021

NE:Tech Meetup, July 8th, 2021

Serverless is always evolving (faster than any definition) and each year new capabilities simplify existing workloads and enable new applications to be implemented in an easier, more efficient way. At AWS, we focused our efforts to increase performance, give options on how to package and deploy, optimize costs for faster interactions, and simplify service integrations. Looking at some of the updates from re:Invent 2020, our yearly learning conference, we introduce the reasoning behind the new features, and how to use them to reduce architecture complexity, including real world examples of what AWS customers are doing, so that you can focus on creating value for YOUR customers.

Danilo Poccia

July 08, 2021
Tweet

More Decks by Danilo Poccia

Other Decks in Programming

Transcript

  1. © 2021, Amazon Web Services, Inc. or its Affiliates.
    What Can You Do
    with Serverless
    Danilo Poccia
    Chief Evangelist (EMEA)
    @danilop
    in 2021

    View Slide

  2. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Photo by Jeremy Bishop on Unsplash

    View Slide

  3. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    We have an idea
    for a new
    web/mobile app!
    How can we build
    it quickly and put
    it in the hands of
    customers?

    View Slide

  4. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    I want to build a mobile app that helps my
    customers store and analyze videos taken with
    their smartphone.
    You can use a serverless architecture to focus
    on the features you want to build. It’ll be much
    easier to scale up if needed. You’ll also be
    driven to think about security as you build it.
    Serverless
    Com
    puting

    View Slide

  5. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Serverless function
    API Call
    File uploaded
    Database updated
    Your code
    Your business logic
    With its own permissions
    Something happens
    Event
    Serverless function
    Serverless function
    Serverless function
    Serverless
    Com
    puting
    Invoke

    View Slide

  6. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Analysis
    Function
    Videos
    Results
    Get Results
    Function
    HTTP API
    Upload
    Get
    Serverless
    Com
    puting
    Event
    Write
    Read
    Event

    View Slide

  7. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Many functions used by my app return very
    quickly, often in less than 20ms.
    Billing
    &
    Cost O
    ptim
    ization
    Billing granularity for Lambda functions has
    been reduced from 100ms down to 1ms with
    no minimum duration. This lowers the price
    for most Lambda functions, more so for short
    duration functions.

    View Slide

  8. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    REPORT RequestId: 35a7e0cb-4902-490d-b8d3-eb315dded660
    Duration: 27.40 ms Billed Duration: 100 ms
    Memory Size: 1024 MB Max Memory Used: 472 MB
    Before
    With 1ms billing granularity
    REPORT RequestId: a24d03b5-429d-4ca3-a490-878a52a0182f
    Duration: 27.55 ms Billed Duration: 28 ms
    Memory Size: 1024 MB Max Memory Used: 472 MB
    1m
    s Billing
    Granularity

    View Slide

  9. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Lambda functions now can have up to 10 GB of
    memory and 6 vCPUs. This is more than a 3x
    increase compared to previous limits.
    I want to be able to process
    high resolution videos.
    Large
    Functions

    View Slide

  10. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Large
    Functions
    https://aws.amazon.com/blogs/aws/new-for-aws-lambda-functions-with-up-to-10-gb-of-memory-and-6-vcpus/

    View Slide

  11. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    https://twitter.com/mooyoul/status/1334205430839472129
    FFm
    peg
    First Case
    Study

    View Slide

  12. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    M
    L
    Inference
    w
    ith
    PyTorch
    https://aws.amazon.com/blogs/aws/new-for-aws-lambda-functions-with-up-to-10-gb-of-memory-and-6-vcpus/
    Same Costs
    5x Faster
    +20% Costs
    7x Faster

    View Slide

  13. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    FFm
    peg
    Second
    Case
    Study
    https://www.sentiatechblog.com/aws-re-invent-2020-day-3-optimizing-lambda-cost-with-multi-threading
    Costs
    Duration

    View Slide

  14. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    I want to process videos faster. It’ll give a
    better customer experience, and with a
    serverless architecture will also be cheaper!
    AVX2
    support
    AWS Lambda now supports Advanced Vector
    Extensions 2 (AVX2), an extension to the x86
    instruction set architecture that enables
    running a set of highly
    parallelizable operations simultaneously.

    View Slide

  15. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates. Source: https://unsplash.com/photos/IMXhx6qhvf0. Photo credit: Daniel Seßler.
    Bicubic filter
    Bilinear filter Lanczos filter
    Im
    age
    Resizing
    U
    sing
    AVX2
    https://aws.amazon.com/blogs/compute/creating-faster-aws-lambda-functions-with-avx2/

    View Slide

  16. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Im
    age
    Resizing
    U
    sing
    AVX2
    Filter Without AVX2 With AVX2
    Performance
    improvement
    Bilinear 105 ms 71 ms 32%
    Bicubic 122 ms 73 ms 40%
    Lanczos 136 ms 77 ms 43%
    https://aws.amazon.com/blogs/compute/creating-faster-aws-lambda-functions-with-avx2/

    View Slide

  17. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    The Lambda functions analyzing videos need
    many large dependencies. For example, I want
    to use a custom machine learning model to
    extract more information.
    Packaging
    &
    Deploym
    ent
    AWS Lambda now supports container images
    as a packaging format with an image size up to
    10 GB. This also helps if you invested in
    container tooling for your development
    workflows.

    View Slide

  18. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    FROM public.ecr.aws/lambda/nodejs:latest
    COPY app.js package*.json ./
    RUN npm install
    CMD [ "app.lambdaHandler" ]
    Dockerfile
    Container Im
    age
    Support
    https://aws.amazon.com/blogs/aws/new-for-aws-lambda-container-image-support/
    You can use base container images
    prepared by AWS and shared via
    Docker Hub and Amazon Elastic
    Container Registry
    (ECR) Public.
    Command can be overwritten by
    providing a different command
    in the template directly.

    View Slide

  19. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    With serverless I can use small functions that
    react to events. But now my main function is
    becoming too big, mixing different capabilities
    such as video resizing and using a custom
    machine learning model.
    O
    rchestration
    &
    Choreography
    You can decompose a large function in small
    tasks that you can execute (and retry)
    independently from each other.
    For example, AWS Step Functions now
    supports Synchronous Express Workflows.

    View Slide

  20. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Synchronous
    Express W
    orkflow
    s
    https://aws.amazon.com/blogs/compute/new-synchronous-express-workflows-for-aws-step-functions/

    View Slide

  21. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Step
    Functions
    W
    orkflow
    Studio
    https://aws.amazon.com/blogs/aws/new-aws-step-functions-workflow-studio-a-low-code-visual-tool-for-building-state-machines

    View Slide

  22. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    https://aws.amazon.com/blogs/compute/modeling-workflow-input-output-path-processing-with-data-flow-simulator
    Step
    Functions
    Data
    Flow
    Sim
    ulator

    View Slide

  23. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Message Queues
    Amazon SQS
    Pub/Sub Messaging
    Amazon SNS
    https://aws.amazon.com/blogs/aws/introducing-amazon-sns-fifo-first-in-first-out-pub-sub-messaging/
    O
    ther Com
    m
    on
    Integrations Patterns

    View Slide

  24. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Amazon SNS
    FIFO Topic
    https://aws.amazon.com/blogs/aws/introducing-amazon-sns-fifo-first-in-first-out-pub-sub-messaging/
    First-In-First-O
    ut
    (FIFO
    )
    + Amazon SQS
    FIFO Queue

    View Slide

  25. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Serverless
    Event Bus

    View Slide

  26. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Lambda functions can be invoked
    synchronously or asynchronously. How can I
    monitor the async execution of Lambda
    functions? How can I get a response, or an
    error, from async invocations?
    O
    rchestration
    &
    Choreography
    You can use Lambda Destinations to
    automatically send the response or the error to
    Lambda functions, SQS queues, SNS topics, or
    an EventBridge event bus.

    View Slide

  27. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    AW
    S
    Lam
    bda
    Destinations
    Lambda Functions – Asynchronous Invocations

    View Slide

  28. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    AW
    S
    Lam
    bda
    Destinations
    Lambda Destinations for Asynchronous Invocations

    View Slide

  29. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    O
    rchestration
    &
    Choreography
    Orchestration Coreography
    Workflow Event-Driven
    Inside a
    (micro)service
    Between
    (micro)services
    AWS Step Functions
    Sync/Async Express Workflow
    Lambda Destinations
    to Lambda, SQS, or SNS
    AWS Step Functions
    Async Standard Workflow
    Lambda Destinations
    to Amazon EventBridge

    View Slide

  30. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    I'd like to use my app with a new use case for a
    regulated industry, such as finance or
    healthcare.
    Security
    There are many security features and
    documentation that can help you with
    compliance.
    You can now also use Code Signing, a trust
    and integrity control for AWS Lambda.

    View Slide

  31. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Security

    View Slide

  32. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Security
    https://docs.aws.amazon.com/whitepapers/latest/security-overview-aws-lambda/welcome.html

    View Slide

  33. © 2021, Amazon Web Services, Inc. or its Affiliates.
    Firecracker microVMs

    View Slide

  34. © 2021, Amazon Web Services, Inc. or its Affiliates.
    Firecracker microVMs
    Firecracker is open-sourced
    under Apache version 2.0
    https://github.com/firecracker-microvm/firecracker

    View Slide

  35. © 2021, Amazon Web Services, Inc. or its Affiliates.
    The principle of least privilege (PoLP)
    Each function and service
    has its own permissions using AWS IAM
    Effect Principal Action Resource Condition
    Allow / Deny Who What Where Filter
    “Every module must be able to access only the information
    and the resources that are necessary for its legitimate purpose”

    View Slide

  36. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    I want to use S3 as the source of truth while
    processing videos and extracting metadata.
    Isn’t S3 eventually consistent while updating
    objects? I have the same issue with my data
    lake where I store and analyze my logs and
    application data.
    Storage
    Amazon S3 now delivers strong
    read-after-write consistency
    automatically for all applications.

    View Slide

  37. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Am
    azon
    S3
    Read-After-W
    rite
    Consistency

    View Slide

  38. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    I want to share the data in my S3 bucket with
    other applications that have different security
    models and may need more information that
    what is stored in the bucket.
    Storage
    You can use S3 Object Lambda to process your
    data with a Lambda function as it is being read
    with a standard S3 API (GetObject).

    View Slide

  39. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Am
    azon
    S3
    O
    bject Lam
    bda
    AWS Cloud
    S3 Bucket
    Supporting
    S3 Access Point
    S3 Object Lambda
    Access Point
    Redacting
    Lambda Function
    E-commerce
    Application
    Analytics
    Application
    Original Object
    Redacted Object
    Marketing
    Application
    S3 Object Lambda
    Access Point
    Enriching
    Lambda Function
    Enriched Object
    Customer Loyalty
    Database

    View Slide

  40. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    I want to use Amazon DynamoDB for its low
    latency and on-demand scalability, but I am
    not familiar with NoSQL and its syntax.
    Database
    You now can use a SQL-compatible query
    language to query, insert, update, and delete
    table data in DynamoDB.
    Also, the NoSQL Workbench can help you
    design your data model and build your
    operations.

    View Slide

  41. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    N
    oSQ
    L
    W
    orkbench

    View Slide

  42. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    N
    oSQ
    L
    W
    orkbench

    View Slide

  43. © 2021, Amazon Web Services, Inc. or its Affiliates.
    Photo by Maarten van den Heuvel on Unsplash
    Case Studies

    View Slide

  44. © 2021, Amazon Web Services, Inc. or its Affiliates.

    View Slide

  45. © 2021, Amazon Web Services, Inc. or its Affiliates.
    The “monolith” at the start of this journey
    Corporate
    data center
    Server contents Server contents
    Tax
    Products CRM
    Fulfillment Rewards
    Server contents

    View Slide

  46. © 2021, Amazon Web Services, Inc. or its Affiliates.
    The “monolith” at the start of this journey
    VPC
    Node.js
    +
    React
    Elastic Beanstalk
    container
    Corporate
    data center
    Server contents Server contents
    Tax
    Products CRM
    Fulfillment Rewards
    Server contents

    View Slide

  47. © 2021, Amazon Web Services, Inc. or its Affiliates.
    The “monolith” at the start of this journey
    VPC
    Node.js
    +
    React
    Elastic Beanstalk
    container
    Server contents Server contents
    Tax
    Products CRM
    Fulfillment Rewards
    VPC
    Gateway
    Corporate
    data center
    Server contents

    View Slide

  48. © 2021, Amazon Web Services, Inc. or its Affiliates.
    Then, during Black Friday 2017 …
    VPC
    Node.js
    +
    React
    Elastic Beanstalk
    container
    Server contents Server contents
    Tax
    Products CRM
    Fulfillment Rewards
    VPC
    Gateway
    503 Service
    Unavailable
    Corporate
    data center
    Server contents

    View Slide

  49. © 2021, Amazon Web Services, Inc. or its Affiliates.
    Consolation in chaos …

    View Slide

  50. © 2021, Amazon Web Services, Inc. or its Affiliates.
    September 2018 – Decoupling the backend
    VPC
    Node.js
    +
    React
    Elastic Beanstalk
    container
    Server contents Server contents
    Tax
    Products CRM
    Fulfillment Rewards
    AWS Cloud
    SaaS
    VPC
    Gateway
    Server contents
    Corporate
    data center

    View Slide

  51. © 2021, Amazon Web Services, Inc. or its Affiliates.
    And the serverless journey begins!

    View Slide

  52. © 2021, Amazon Web Services, Inc. or its Affiliates.
    Black Friday 2018

    View Slide

  53. © 2021, Amazon Web Services, Inc. or its Affiliates.
    July 10, 2019
    shop.LEGO.com
    was switched to
    serverless
    on AWS

    View Slide

  54. © 2021, Amazon Web Services, Inc. or its Affiliates.
    https://speakerdeck.com/danilop/how-lego-dot-com-accelerates-innovation-with-serverless
    https://www.youtube.com/watch?v=HcbnrJdNBRI
    Slides
    Video
    https://speakerdeck.com/danilop/the-serverless-journey-of-shop-dot-lego-dot-com
    https://www.youtube.com/watch?v=20KBtJOxUpw
    Slides
    Video
    AW
    S
    re:Invent
    2019
    &
    2020

    View Slide

  55. © 2021, Amazon Web Services, Inc. or its Affiliates.

    View Slide

  56. © 2021, Amazon Web Services, Inc. or its Affiliates.
    Sky Italia – Real-Time Sports Updates

    View Slide

  57. © 2021, Amazon Web Services, Inc. or its Affiliates.
    Sky Italia – Real-Time Sports Updates

    View Slide

  58. © 2021, Amazon Web Services, Inc. or its Affiliates.
    Sky Italia – Benefits of AWS
    ü Delivers real-time sports data updates
    ü Reduced costs by 30%
    ü Accelerated data propagation by 15x
    ü Achieved elasticity during times of peak and off-peak traffic
    ü Reduced time to market when developing new components
    ü Improved search engine optimization

    View Slide

  59. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    How can I start being more “serverless”?
    Getting
    Started
    Have a look at these tools!
    AWS Amplify – AWS CDK – AWS SAM
    Serverless Framework
    Hashicorp Terraform

    View Slide

  60. © 2021, Amazon Web Services, Inc. or its Affiliates.
    © 2021, Amazon Web Services, Inc. or its Affiliates.
    Photo by veeterzy on Unsplash

    View Slide

  61. © 2021, Amazon Web Services, Inc. or its Affiliates.
    Thank you!
    Please give me your feeback J
    Danilo Poccia
    Chief Evangelist (EMEA)
    @danilop

    View Slide