serverless architecture

29
Serverless Architecture Ladislav Pr skavec PragueJS, 30.6.2016 1

Upload: ladislav-prskavec

Post on 16-Apr-2017

173 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Serverless Architecture

Serverless ArchitectureLadislav Prskavec

PragueJS, 30.6.2016 1

Page 2: Serverless Architecture

Serverless is a hot topic in the software architecture

world.1

Mike Roberts

PragueJS, 30.6.2016 2

Page 3: Serverless Architecture

What is Serverless?

PragueJS, 30.6.2016 3

Page 4: Serverless Architecture

Backend as a Service

and

Function as a ServicePragueJS, 30.6.2016 4

Page 5: Serverless Architecture

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 backendPragueJS, 30.6.2016 5

Page 6: Serverless Architecture

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

Page 7: Serverless Architecture

Amazon Lambda

PragueJS, 30.6.2016 7

Page 8: Serverless Architecture

Amazon Lambda - Inputs4 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

Page 9: Serverless Architecture

Amazon Lambda - Processing4 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 scalePragueJS, 30.6.2016 9

Page 10: Serverless Architecture

Amazon Lambda - Outputs4 Event

4 Storage

4 Messaging

PragueJS, 30.6.2016 10

Page 11: Serverless Architecture

Cost effectiveScenario - 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

Page 12: Serverless Architecture

Frameworks4 Apex

4 Serverless

4 Zappa

4 Sparta

PragueJS, 30.6.2016 12

Page 13: Serverless Architecture

Apex - http://apex.run4 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

Page 14: Serverless Architecture

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

Page 15: Serverless Architecture

Zappa - https://zappa.gun.io4 in Python support Python

4 https://github.com/Miserlou/lambda-packages

4 https://github.com/Miserlou/django-zappa

PragueJS, 30.6.2016 15

Page 16: Serverless Architecture

Sparta - http://gosparta.io4 in Golang support Golang

4 CloudFormation

PragueJS, 30.6.2016 16

Page 17: Serverless Architecture

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

Page 18: Serverless Architecture

Testing4 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

Page 19: Serverless Architecture

Architectures examples

PragueJS, 30.6.2016 19

Page 20: Serverless Architecture

PragueJS, 30.6.2016 20

Page 21: Serverless Architecture

PragueJS, 30.6.2016 21

Page 22: Serverless Architecture

PragueJS, 30.6.2016 22

Page 23: Serverless Architecture

PragueJS, 30.6.2016 23

Page 24: Serverless Architecture

PragueJS, 30.6.2016 24

Page 25: Serverless Architecture

PragueJS, 30.6.2016 25

Page 26: Serverless Architecture

PragueJS, 30.6.2016 26

Page 27: Serverless Architecture

PragueJS, 30.6.2016 27

Page 28: Serverless Architecture

Q & A

PragueJS, 30.6.2016 28

Page 29: Serverless Architecture

Resources4 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