Slide 1

Slide 1 text

HOW SMALL CAN YOU GO? MICROSERVICES SERVERLESS (WITH AWS ) LAMBDA Niko Köbler So ware-Architect, Developer & Trainer | | [email protected] www.n-k.de @dasniko

Slide 2

Slide 2 text

@dasniko

Slide 3

Slide 3 text

DISCLAIMER This is silver bullet, NO no standard, but opinionated!

Slide 4

Slide 4 text

SERVERLESS

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

This is what actually mean... serverless

Slide 7

Slide 7 text

It's all about the of servers! management

Slide 8

Slide 8 text

HOW COULD THIS HAPPEN? We had... Monoliths Distributed Monoliths Self-contained Systems Microservices Bounded Contexts PaaS BaaS

Slide 9

Slide 9 text

...and now, finally, we have... F S AA Function as a Service

Slide 10

Slide 10 text

FUNCTIONS Running own code (function) in an external, sandboxed, stateless (and transient) compute container. No application server, no embedded server no Docker ;-)

Slide 11

Slide 11 text

? PAAS

Slide 12

Slide 12 text

PaaS FaaS vs. is as DevOps NoOps vs.

Slide 13

Slide 13 text

AWS LAMBDA

Slide 14

Slide 14 text

AWS LAMBDA Event Driven JVM-based languages (Java 8), JavaScript (Node.js), Python, (more to come) AWS Libraries are available at runtime Versions, Aliases via ARNs calculating time based costs, 100ms blocks (e.g. 100ms w/ 128MB memory = USD 0.000000208)

Slide 15

Slide 15 text

AWS LAMBDA EXAMPLE NODE exports.handler = (event, context) => { console.log('Received event:', JSON.stringify(event)); }

Slide 16

Slide 16 text

AWS LAMBDA EXAMPLE JAVA public class ImageProcessor implements RequestHandler { @Override public Void handleRequest(S3Event s3Event, Context context) { // get the S3 event data from the event request S3EventNotification.S3EventNotificationRecord record = s3Event.getRecords().get(0); // your code goes here... // return an object with specified type (see class generics) return null; } }

Slide 17

Slide 17 text

AWS EVENTS LAMBDA S3 Cloud Watch Config DynamoDB Cloud Formation Kinesis Cognito SES Cron AWS IoT SNS API Gateway (no complete list)

Slide 18

Slide 18 text

GATEWAY API

Slide 19

Slide 19 text

GATEWAY API "Reverse Proxy" hides possible multiple service calls (aka "service composition", ESB?) distributes requests to proper service instances "Mock" services

Slide 20

Slide 20 text

API GATEWAY NETFLIX

Slide 21

Slide 21 text

GATEWAY API "Reverse Proxy" hides possible multiple service calls (aka "service composition", ESB?) distributes requests to proper service instances "Mock" services

Slide 22

Slide 22 text

GATEWAY API AUTHENTICATION / AUTHORIZATION AWS Cognito / STS Custom Authorizer (Lambda Function, returning IAM policies)

Slide 23

Slide 23 text

API GATEWAY AUTHORIZATION

Slide 24

Slide 24 text

GATEWAY API

Slide 25

Slide 25 text

CASES USE

Slide 26

Slide 26 text

SERVERLESS ARCHITECTURE WEB

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

API Gateway with , Push and SNS SQS

Slide 30

Slide 30 text

TESTING

Slide 31

Slide 31 text

TESTING UNIT TESTS Functions are easy to test, stateless and little to no dependencies

Slide 32

Slide 32 text

TESTING INTEGRATION TESTS Environment, Infrastructure max. 1000 parallel running Lambdas

Slide 33

Slide 33 text

COMPETITORS?

Slide 34

Slide 34 text

COMPETITOR GOOGLE CLOUD FUNCTIONS JavaScript

Slide 35

Slide 35 text

COMPETITOR MICROSOFT AZURE FUNCTIONS JavaScript, C#, Python, PHP

Slide 36

Slide 36 text

ON ? PREMISE

Slide 37

Slide 37 text

COMPETITOR IBM BLUEMIX OPENWHISK Bluemix Cloud & OnPremise Open Source / Apache License v2.0 JavaScript (Node.js), Java (?) Python and... Swi ! Docker Support Function-Chaining

Slide 38

Slide 38 text

IBM OPENWHISK LET'S GET STARTED $ git clone https://github.com/openwhisk/openwhisk.git $ cd openwhisk/tools/vagrant $ vagrant up

Slide 39

Slide 39 text

IBM OPENWHISK JAVASCRIPT EXAMPLE function main(params) { return {payload: 'Hello, ' + params.name}; } Create the action in OpenWhisk $ wsk action create hello hello.js Run the action $ wsk action invoke hello --blocking --result --param name Niko Result { "payload": "Hello, Niko" }

Slide 40

Slide 40 text

DRAWBACKS Overview: Documentation, Logging & Monitoring, Metrics ! (typical things for distributed environments) Cloud Provider Binding / Dependency: APIs, Portability, Costs, SLAs

Slide 41

Slide 41 text

DRAWBACK LATENCY https://twitter.com/patrickdebois/status/795355324987375616

Slide 42

Slide 42 text

DRAWBACK LATENCY https://www.prerender.cloud/lambda-latency

Slide 43

Slide 43 text

? CURIOUS WANT TO START? Give a try! serverless.com

Slide 44

Slide 44 text

SERVERLESS.COM # Install serverless globally $ npm install serverless -g # Create an AWS Lamdba function in Node.js $ serverless create --template aws-nodejs # Deploy to live AWS account $ serverless deploy # Function deployed! $ http://api.amazon.com/users/update "Powered by AWS Lambda"

Slide 45

Slide 45 text

BUT POWERFUL SERVERLESS No need to run/manage Application Servers Fast results, minimal effort, minimal TTM(!) Low costs, minimal financial risk Automatic Scalabiltiy and Availability "out-of-the-box"

Slide 46

Slide 46 text

THANK ! YOU ANY ? QUESTIONS Niko Köbler So ware-Architect, Developer & Trainer | | [email protected] www.n-k.de @dasniko

Slide 47

Slide 47 text

LINKS AWS Lambda: Amazon API Gateway: Google Cloud Functions: Microso Azure Functions: IBM OpenWhisk: IBM OpenWhisk SourceCode: Serverless Framework: https://aws.amazon.com/lambda https://aws.amazon.com/api- gateway https://cloud.google.com/functions https://azure.microso .com/services/functions https://developer.ibm.com/openwhisk https://github.com/openwhisk/openwhisk http://serverless.com