Datascript: Serverless Architecture

Datascript: Serverless Architecture

Serverless architecture, FaaS status in December 2016.

55d57afc217d360cd3aad3e2a8d4e5a0?s=128

Ladislav Prskavec

December 12, 2016
Tweet

Transcript

  1. Serverless Architecture Ladislav Prskavec Datascript, 13.12.2016 1

  2. Serverless is a hot topic in the software architecture world.

    — Mike Roberts Datascript, 13.12.2016 2
  3. Is Serverless buzzword? Datascript, 13.12.2016 3

  4. Backend as a Service and Function as a Service Datascript,

    13.12.2016 4
  5. Backend as a Service (BaaS) » Firebase - DB +

    Auth » Hoodie - Offline first, PouchDB » Algolia - Search » Auth0 - SSO, Token Based Auth » Kinvey - Mobile Backend as Service » Syncano - Assemble your backend Datascript, 13.12.2016 5
  6. Function as a Service (FaaS) » Amazon Lambda & API

    Gateway (Nov'14) » IBM Bluemix Openwhisk (Feb'16) » Google Cloud Functions (Feb'16) » Azure Functions (Mar'16) » Webtask.io (Mar'15) Datascript, 13.12.2016 6
  7. Amazon Lambda Datascript, 13.12.2016 7

  8. Amazon Lambda - Inputs » Event Source » API Gateway

    » S3 » Kinesis » DynamoDB » AWS Config » Amazon Cognito » AWS CloudFormation » ... Datascript, 13.12.2016 8
  9. Amazon Lambda - Processing » Compute Service » Languages (NodeJS

    0.10 and 4.3, Java, Python, C#) » Security Model (IAM, VPC) » Cascading (AWS Step Functions) » Run code at any scale » Charged on execution scale Datascript, 13.12.2016 9
  10. Amazon Lambda - Outputs » Event » Storage » Messaging

    Datascript, 13.12.2016 10
  11. Cost effective Scenario - 16k req/day @ 200ms avg =

    3200 s/day $2.97/day - 2 EC2 instances (upfront) $0.05/day - Lambda (1GB) Datascript, 13.12.2016 11
  12. AWS Serverless Application Model (AWS SAM) » https://github.com/awslabs/serverless-application-model » AWS

    SAM is a model used to define serverless applications on AWS. » Specification » AWS SAM is based on AWS CloudFormation. Datascript, 13.12.2016 12
  13. AWSTemplateFormatVersion: '2010-09-09' Transform: 'AWS::Serverless-2016-10-31' Resources: MyFunction: Type: 'AWS::Serverless::Function' Properties: Handler:

    index.handler Runtime: nodejs4.3 CodeUri: 's3://my-bucket/function.zip' Datascript, 13.12.2016 13
  14. Amazon States Language » Specification » Linter - https://github.com/awslabs/statelint Datascript,

    13.12.2016 14
  15. { "Comment": "A Retry example of the Amazon States Language

    using an AWS Lambda Function", "StartAt": "HelloWorld", "States": { "HelloWorld": { "Type": "Task", "Resource": "arn:aws:lambda:us-east-1:123456789012:function:FailFunction", "Retry": [ { "ErrorEquals": ["HandledError"], "IntervalSeconds": 1, "MaxAttempts": 2, "BackoffRate": 2.0 }, { "ErrorEquals": ["States.TaskFailed"], "IntervalSeconds": 30, "MaxAttempts": 2, "BackoffRate": 2.0 }, "ErrorEquals": ["States.ALL"], "IntervalSeconds": 5, "MaxAttempts": 5, "BackoffRate": 2.0 } ], "End": true } } } Datascript, 13.12.2016 15
  16. Frameworks » Chalice » Apex » Serverless » Zappa »

    Sparta Datascript, 13.12.2016 16
  17. Chalice » Python » https://github.com/awslabs/chalice » microframework Datascript, 13.12.2016 17

  18. Apex - http://apex.run » in golang support nodejs, golang, python,

    java » optional terraform support » multiple deployment targets for different environments » idempotent deployments » author @tjholowaychuk Datascript, 13.12.2016 18
  19. Serverless - http://www.serverless.com » in NodeJS, actual version 1.3.0 »

    support aws-nodejs, aws-python, aws-java-gradle, aws-java- maven, aws-scala-sbt, aws-csharp » config in serverless.yml » support env variables (support added into Lambda in November'16) » AWS CloudFormation Datascript, 13.12.2016 19
  20. Zappa - https://zappa.gun.io » in Python support Python » https://github.com/Miserlou/lambda-packages

    » https://github.com/Miserlou/django-zappa Datascript, 13.12.2016 20
  21. Sparta - http://gosparta.io » in Golang support Golang » CloudFormation

    Datascript, 13.12.2016 21
  22. Libraries and utils » claudiajs » aws-serverless-express Datascript, 13.12.2016 22

  23. ClaudiaJS » NodeJS » Claudia is not trying to change

    the way you structure or run projects. » Deployment utility » https://github.com/claudiajs/claudia Datascript, 13.12.2016 23
  24. AWS Serverless Express » extends ExpressJS » NodeJS 4.3 LTS

    » https://github.com/awslabs/aws-serverless-express » cannot use native packages » currently no support for binary data (AWS Gateway have support from Nov'16) Datascript, 13.12.2016 24
  25. Security » https://github.com/vandium-io/vandium-node » Powerful input validation, Forces values into

    correct types » JSON Web Token (JWT) verification and validation » Cross Site Request Forgery (XSRF) detection when using JWT » SQL Injection (SQLi) detection and protection » Environment variable mapping, » Free resources post handler execution » Handles uncaught exceptions » Promise support Datascript, 13.12.2016 25
  26. Testing » https://github.com/lambci/docker-lambda/ » Docker images and test runners that

    replicate the live AWS Lambda environment » NodeJS 0.10/4.3 » Python » Java8 Datascript, 13.12.2016 26
  27. Architectures examples Datascript, 13.12.2016 27

  28. Datascript, 13.12.2016 28

  29. Datascript, 13.12.2016 29

  30. Datascript, 13.12.2016 30

  31. Datascript, 13.12.2016 31

  32. Datascript, 13.12.2016 32

  33. Datascript, 13.12.2016 33

  34. Datascript, 13.12.2016 34

  35. Datascript, 13.12.2016 35

  36. API Gateway & Lambda problems » limit 6MB on Lambda

    response » API Gateway don't support gzip » problems with with strange 500 errors without » not parsable error object from Lambda into API Gateway » API Gateway template system (based on Velocity templates) » problem with local testing API Gateway Datascript, 13.12.2016 36
  37. Q & A Datascript, 13.12.2016 37

  38. re:Invent 2016 sessions » Videos - https://gist.github.com/stevenringo/ 5f0f9cc7b329dbaa76f495a6af8241e9 » Slides

    - http://www.slideshare.net/AmazonWebServices/ tagged/reinvent2016 Datascript, 13.12.2016 38
  39. Resources » https://aws.amazon.com/lambda/ » https://github.com/anaibol/awesome-serverless » https://cloudcraft.co » https://github.com/lambci/docker-lambda/ »

    http://www.allthingsdistributed.com/2016/05/aws-lambda-serverless-reference- architectures.html » https://www.thoughtworks.com/radar/techniques/serverless-architecture » https://serifandsemaphore.io/azure-cloud-functions-vs-aws-lambda- caf8a90605dd#.dbk2yntw1 » https://github.com/donnemartin/awesome-aws Datascript, 13.12.2016 39