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

Datascript: Serverless Architecture

Datascript: Serverless Architecture

Serverless architecture, FaaS status in December 2016.

Ladislav Prskavec

December 12, 2016
Tweet

More Decks by Ladislav Prskavec

Other Decks in Technology

Transcript

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

    — Mike Roberts Datascript, 13.12.2016 2
  2. 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
  3. 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
  4. Amazon Lambda - Inputs » Event Source » API Gateway

    » S3 » Kinesis » DynamoDB » AWS Config » Amazon Cognito » AWS CloudFormation » ... Datascript, 13.12.2016 8
  5. 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
  6. 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
  7. 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
  8. { "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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. re:Invent 2016 sessions » Videos - https://gist.github.com/stevenringo/ 5f0f9cc7b329dbaa76f495a6af8241e9 » Slides

    - http://www.slideshare.net/AmazonWebServices/ tagged/reinvent2016 Datascript, 13.12.2016 38
  18. 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