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

Get Started with Your Serverless API

Get Started with Your Serverless API

Sawadee Khrup!

Wondering how you can start your first serverless API in no time? This deck will show you how, along with the demo and also source code available on Github. Deck, demo and source code was prepared for AWS User Group meetup in Chiang Mai, Thailand.

Donnie Prakoso

December 14, 2018
Tweet

More Decks by Donnie Prakoso

Other Decks in Technology

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
    Donnie Prakoso
    AWS Technology Evangelist, ASEAN
    Get Started with Your Serverless API
    Deep Dive into AWS SAM
    @donnieprakoso
    donnieprakoso

    View full-size slide

  2. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    >hello, world
    Donnie Prakoso, MSc
    AWS Technology Evangelist, ASEAN
    @donnieprakoso
    donnieprakoso
    • Developer + café racer + self-proclaimed barista
    • Speak in Go and Python
    • I AWS User Groups

    View full-size slide

  3. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    What We Are Going to Discuss
    • What really happen behind “Let’s Build an App!”
    • Setting foundation of serverless paradigm
    • Serverless is bigger than FaaS
    • Introducing AWS SAM
    • Creating your first API
    • Thank you!

    View full-size slide

  4. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Let’s Build an App!

    View full-size slide

  5. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Presentation Tier Logic Tier Data Tier
    Mobile App App Server Database

    View full-size slide

  6. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Here is what that translates to in real life
    http://media.amazonwebservices.com/architecturecenter/AWS_ac_ra_web_01.pdf

    View full-size slide

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

    View full-size slide

  8. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Server-less Computing
    Serverless computing allows you to build and run
    applications and services without thinking about servers.

    View full-size slide

  9. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Because time is valuable

    View full-size slide

  10. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Serverless Means …
    No servers to provision
    or manage
    Scales with usage
    Never pay for idle Built in availability and
    fault tolerance

    View full-size slide

  11. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Serverless Applications
    Services (anything)
    Changes in
    data state
    Requests to
    endpoints
    Changes in
    resource state
    Event source Lambda function
    Node.js
    Python
    Java
    C#
    Go

    View full-size slide

  12. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    DEMO – AWS Lambda

    View full-size slide

  13. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Focus on building business logic.
    !

    View full-size slide

  14. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Common Serverless Application Use Cases
    Web
    applications
    • Static
    websites
    • Complex web
    apps
    • Packages for
    Flask and
    Express
    Data
    processing
    • Real-time
    • MapReduce
    • Batch
    • Machine
    learning
    inference
    Chatbots
    • Powering
    chatbot logic
    Backends
    • Apps and
    services
    • Mobile
    • IoT
    >
    >
    Amazon
    Alexa
    • Powering
    voice-enabled
    apps
    • Alexa
    Skills Kit
    IT
    automation
    • Policy engines
    • Extending
    AWS services
    • Infrastructure
    management

    View full-size slide

  15. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Translating this…
    http://media.amazonwebservices.com/architecturecenter/AWS_ac_ra_web_01.pdf
    …to

    View full-size slide

  16. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    The server-less stack
    Internet
    Mobile apps
    AWS Lambda
    functions
    AWS
    API Gateway
    Other AWS
    services

    View full-size slide

  17. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Meet AWS SAM.

    View full-size slide

  18. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    sam init
    sam local start-api
    sam package
    sam validate
    sam deploy
    sam logs
    1 Create project
    2 Test locally
    3 Validate template
    4 Package into CF
    5 Deploy
    6 Check the logs
    Development
    Deployment
    Monitoring

    View full-size slide

  19. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    Lambda execution model
    Synchronous
    (push)
    Asynchronous
    (event)
    Stream-based
    Amazon
    API Gateway
    AWS Lambda
    function
    Amazon
    DynamoDB
    Amazon
    SNS
    /order
    AWS Lambda
    function
    Amazon
    S3
    reqs
    Amazon
    Kinesis
    changes
    AWS Lambda
    service
    function

    View full-size slide

  20. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
    In Summary
    • Serverless is not only the underlying technology but also a paradigm
    • AWS SAM helps you to kickstart your project
    • Start with defining your resources. Start small.
    • Automate resources creation, packaging and deployment
    • Centralized monitoring tool

    View full-size slide

  21. © 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
    Go Build!
    Donnie Prakoso
    AWS Technology Evangelist, ASEAN
    @donnieprakoso
    donnieprakoso

    View full-size slide