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

Serverless Architecture - PragueJS 30.6.2016

Serverless Architecture - PragueJS 30.6.2016

Serverless can also mean applications where some amount of server-side logic is still written by the application developer but Function as a Service, unlike traditional architectures is run in stateless compute containers that are event-triggered, ephemeral (may only last for one invocation), and fully managed by a 3rd party.

Ladislav Prskavec

June 30, 2016
Tweet

More Decks by Ladislav Prskavec

Other Decks in Technology

Transcript

  1. Serverless Architectures
    Ladislav Prskavec
    PragueJS, 30.6.2016 1

    View Slide

  2. Serverless is a hot topic in
    the software architecture
    world.
    1
    Mike Roberts
    PragueJS, 30.6.2016 2

    View Slide

  3. What is Serverless?
    PragueJS, 30.6.2016 3

    View Slide

  4. Backend as a Service
    and
    Function as a Service
    PragueJS, 30.6.2016 4

    View Slide

  5. Backend as a Service (BaaS)
    4 Firebase - DB + Auth
    4 Hoodie - Offline first, PouchDB
    4 Algolia - Search
    4 Auth0 - SSO, Token Based Auth
    4 Kinvey - Mobile Backend as Service
    4 Syncano - Assemble your backend
    PragueJS, 30.6.2016 5

    View Slide

  6. Function as a Service (FaaS)
    4 Amazon Lambda & API Gateway (Nov'14)
    4 IBM Bluemix Openwhisk (Feb'16)
    4 Google Cloud Functions (Feb'16)
    4 Azure Functions (Mar'16)
    4 Webtask.io (Mar'15)
    PragueJS, 30.6.2016 6

    View Slide

  7. Amazon Lambda
    PragueJS, 30.6.2016 7

    View Slide

  8. Amazon Lambda - Inputs
    4 Event Source
    4 API Gateway
    4 S3
    4 Kinesis
    4 DynamoDB
    4 AWS Config
    4 Amazon Cognito
    4 AWS CloudFormation
    4 ...
    PragueJS, 30.6.2016 8

    View Slide

  9. Amazon Lambda - Processing
    4 Compute Service
    4 Languages (NodeJS 0.10 and 4.3, Java, Python)
    4 Security Model (IAM, VPC)
    4 Cascading
    4 Run code at any scale
    4 Charged on execution scale
    PragueJS, 30.6.2016 9

    View Slide

  10. Amazon Lambda - Outputs
    4 Event
    4 Storage
    4 Messaging
    PragueJS, 30.6.2016 10

    View Slide

  11. Cost effective
    Scenario - 16k req/day @ 200ms avg = 3200 s/day
    $2.97/day - 2 EC2 instances (upfront)
    $0.05/day - Lambda (1GB)
    PragueJS, 30.6.2016 11

    View Slide

  12. Frameworks
    4 Apex
    4 Serverless
    4 Zappa
    4 Sparta
    PragueJS, 30.6.2016 12

    View Slide

  13. Apex - http://apex.run
    4 in golang support nodejs, golang, python, java
    4 optional terraform support
    4 multiple deployment targets for different
    environments
    4 idempotent deployments
    4 author @tjholowaychuk
    PragueJS, 30.6.2016 13

    View Slide

  14. Serverless - http://www.serverless.com
    4 in NodeJS support Javascript only
    4 Beta, still many changes, roadmap to 1.0
    4 CloudFormation
    4 Many Plugins
    PragueJS, 30.6.2016 14

    View Slide

  15. Zappa - https://zappa.gun.io
    4 in Python support Python
    4 https://github.com/Miserlou/lambda-packages
    4 https://github.com/Miserlou/django-zappa
    PragueJS, 30.6.2016 15

    View Slide

  16. Sparta - http://gosparta.io
    4 in Golang support Golang
    4 CloudFormation
    PragueJS, 30.6.2016 16

    View Slide

  17. Security
    4 https://github.com/vandium-io/vandium-node
    4 Powerful input validation, Forces values into correct types
    4 JSON Web Token (JWT) verification and validation
    4 Cross Site Request Forgery (XSRF) detection when using JWT
    4 SQL Injection (SQLi) detection and protection
    4 Environment variable mapping,
    4 Free resources post handler execution
    4 Handles uncaught exceptions
    4 Promise support
    PragueJS, 30.6.2016 17

    View Slide

  18. Testing
    4 https://github.com/lambci/docker-lambda/
    4 Docker images and test runners that replicate the
    live AWS Lambda environment
    4 NodeJS 0.10/4.3
    4 Python
    PragueJS, 30.6.2016 18

    View Slide

  19. Architectures examples
    PragueJS, 30.6.2016 19

    View Slide

  20. PragueJS, 30.6.2016 20

    View Slide

  21. PragueJS, 30.6.2016 21

    View Slide

  22. PragueJS, 30.6.2016 22

    View Slide

  23. PragueJS, 30.6.2016 23

    View Slide

  24. PragueJS, 30.6.2016 24

    View Slide

  25. PragueJS, 30.6.2016 25

    View Slide

  26. PragueJS, 30.6.2016 26

    View Slide

  27. PragueJS, 30.6.2016 27

    View Slide

  28. Q & A
    PragueJS, 30.6.2016 28

    View Slide

  29. Resources
    4 https://aws.amazon.com/lambda/
    4 https://github.com/anaibol/awesome-serverless
    4 https://cloudcraft.co
    4 https://github.com/lambci/docker-lambda/
    4 http://www.allthingsdistributed.com/2016/05/aws-lambda-serverless-
    reference-architectures.html
    4 https://www.thoughtworks.com/radar/techniques/serverless-architecture
    4 https://serifandsemaphore.io/azure-cloud-functions-vs-aws-lambda-
    caf8a90605dd#.dbk2yntw1
    PragueJS, 30.6.2016 29

    View Slide