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

Taking Python Serverless: Using Zappa to Deploy Webapps Without Infrastructure

maltzj
November 12, 2019

Taking Python Serverless: Using Zappa to Deploy Webapps Without Infrastructure

So you've built your Python application and want to deploy it to your users. How do you go about that? One increasingly common answer to that question is ""deploy it as a serverless application"". What does it mean to deploy a serverless app, and how can you try out serverless in a low-risk way?

This talk will answer both of those questions. First, it will give an overview of serverless applications and the advantages they provide over other deployment modes. Next it will dig into Zappa, a library for deploying serverless python apps, and show how Zappa allows you to deploy your webapp as a serverless application in seconds. This ease also comes with trade-offs, so the talk will close by discussing what you lose with Zappa and how we've worked around those limits at Nuna. By the end of this talk, you'll have a better understanding of serverless applications and you'll be able to evaluate if Zappa is the right fit for your needs.

Talk Resources:

Zappa: https://github.com/Miserlou/Zappa
Serverless: https://serverless.com/
AWS SAM: https://aws.amazon.com/serverless/sam/
Chalice - https://github.com/aws/chalice
PEP 333 - https://www.python.org/dev/peps/pep-0333/
AWS Lambda Limitations - https://docs.aws.amazon.com/lambda/latest/dg/limits.html
Serverless Conf NYC: https://acloud.guru/series/serverlessconf-nyc-2019
Google Cloud Run: https://cloud.google.com/run/
AWS Fargate: https://aws.amazon.com/fargate/

maltzj

November 12, 2019
Tweet

More Decks by maltzj

Other Decks in Programming

Transcript

  1. @maltzj
    Taking Python Serverless:
    Using Zappa to Deploy
    Webapps Without
    Infrastructure
    Jonathan Maltz
    @maltzj
    11-13-19
    AUTHOR DATE

    View Slide

  2. @maltzj
    @maltzj
    I just wrote my
    python
    webapp!

    View Slide

  3. @maltzj
    @maltzj

    View Slide

  4. @maltzj
    @maltzj
    Build a .whl file

    View Slide

  5. @maltzj
    @maltzj
    Build a .whl file
    Deploy to an
    EC2 instance

    View Slide

  6. @maltzj
    @maltzj
    Build a .whl file
    Deploy to an
    EC2 instance
    Gunicorn

    View Slide

  7. @maltzj
    @maltzj
    Build a .whl file
    Deploy to an
    EC2 instance
    Gunicorn nginx

    View Slide

  8. @maltzj
    @maltzj

    View Slide

  9. @maltzj
    @maltzj
    Add your
    python code Gunicorn nginx

    View Slide

  10. @maltzj
    @maltzj
    nginx

    View Slide

  11. @maltzj
    @maltzj

    View Slide

  12. @maltzj
    @maltzj

    View Slide

  13. @maltzj
    @maltzj
    Lambda's Promise: Give me
    a zip file within some
    constraints, and I'll just run
    that code for you

    View Slide

  14. @maltzj
    @maltzj
    How can it talk to
    the world?

    View Slide

  15. @maltzj
    @maltzj

    View Slide

  16. @maltzj
    @maltzj
    API Gateway's Promise: I'll
    manage all your RESTful
    APIs in front of AWS
    services

    View Slide

  17. @maltzj
    @maltzj

    View Slide

  18. @maltzj
    @maltzj

    View Slide

  19. @maltzj
    @maltzj
    Serverless Frameworks!

    View Slide

  20. @maltzj
    @maltzj
    Serverless Frameworks:
    Tools that let you stitch
    together your serverless code
    and provision the necessary
    cloud resources.

    View Slide

  21. @maltzj
    ● Zappa
    Serverless Frameworks

    View Slide

  22. @maltzj
    ● Zappa
    ● Serverless
    Serverless Frameworks

    View Slide

  23. @maltzj
    ● Zappa
    ● Serverless
    ● AWS SAM
    Serverless Frameworks

    View Slide

  24. @maltzj
    ● Zappa
    ● Serverless
    ● AWS SAM
    ● Chalice
    Serverless Frameworks

    View Slide

  25. @maltzj
    ● Zappa
    ● Serverless
    ● AWS SAM
    ● Chalice
    Serverless Frameworks

    View Slide

  26. @maltzj
    @maltzj

    View Slide

  27. @maltzj
    @maltzj
    WSGI

    View Slide

  28. @maltzj
    @maltzj
    Application Server

    View Slide

  29. @maltzj
    @maltzj
    Application
    Server
    (Things that deal with raw
    HTTP)

    View Slide

  30. @maltzj
    @maltzj
    Application
    (Frameworks that
    use parsed HTTP)
    Server
    (Things that deal with raw
    HTTP)

    View Slide

  31. @maltzj
    @maltzj
    Application
    (Frameworks that
    use parsed HTTP)
    Server
    (Things that deal with raw
    HTTP)
    callable(environ, start_response)

    View Slide

  32. @maltzj
    @maltzj
    Application
    (Frameworks that
    use parsed HTTP)
    Server
    (Things that deal with raw
    HTTP)
    callable(environ, start_response)

    View Slide

  33. @maltzj
    @maltzj
    Application
    (Frameworks that
    use parsed HTTP)
    Server
    (Things that deal with raw
    HTTP)
    callable(environ, start_response)

    View Slide

  34. @maltzj
    @maltzj
    So what?

    View Slide

  35. @maltzj
    @maltzj
    Zappa Handler
    (Speaks WSGI)
    Your WSGI App

    View Slide

  36. @maltzj
    @maltzj
    Zappa Handler
    (Speaks WSGI)
    Your WSGI App Zappa CLI

    View Slide

  37. @maltzj
    @maltzj
    Zappa Handler
    (Speaks WSGI)
    Your WSGI App Zappa CLI
    Lambda-ready Zip

    View Slide

  38. @maltzj
    @maltzj
    Zappa Handler
    (Speaks WSGI)
    Your WSGI App Zappa CLI
    Lambda-ready Zip
    AWS

    View Slide

  39. @maltzj
    @maltzj
    Zappa Handler
    (Speaks WSGI)
    Your WSGI App Zappa CLI
    Lambda-ready Zip
    AWS
    Opinionated cloud
    provisioning (via Boto)

    View Slide

  40. @maltzj
    @maltzj

    View Slide

  41. @maltzj
    @maltzj

    View Slide

  42. @maltzj
    ● No servers == rethinking lots of assumptions
    ○ How do I get to my DB?
    ○ Where are my logs?
    ○ Lean on cloud services to mitigate
    ● Some constraint on what you can build
    ○ Lambda size limits, application response sizes
    ○ Many can be worked around
    Some things to be aware of

    View Slide

  43. @maltzj
    How's Zappa Overall?
    ● Very quick if you will play within its box
    ○ WSGI webapps, only python
    ● Maintenance story is not great
    ● Would suggest evaluating alongside serverless +
    plugins

    View Slide

  44. @maltzj
    @maltzj

    View Slide

  45. @maltzj
    ● Zappa: https://github.com/Miserlou/Zappa
    ● Serverless: https://serverless.com/
    ● AWS SAM: https://aws.amazon.com/serverless/sam/
    ● Chalice - https://github.com/aws/chalice
    ● PEP 333 - https://www.python.org/dev/peps/pep-0333/
    ● AWS Lambda Limitations -
    https://docs.aws.amazon.com/lambda/latest/dg/limits.html
    ● Serverless Conf NYC:
    https://acloud.guru/series/serverlessconf-nyc-2019
    ● Google Cloud Run: https://cloud.google.com/run/
    ● AWS Fargate: https://aws.amazon.com/fargate/
    Resources

    View Slide

  46. @maltzj
    @maltzj
    https://boards.greenhouse.io/nuna/

    View Slide