44
ARCHITECTURES SERVERLESS (WITH INFRASTRUCTURE) AWS Niko Köbler Soware-Architect, Developer & Trainer | | [email protected] www.n-k.de @dasniko

SERVERLESS ARCHITECTURES - sigs.de · S E RV E R L E SS COMPUT E MAN I F E STO Functions are the unit of deployment and scaling. No machines, VMs, or containers visible in the programming

Embed Size (px)

Citation preview

ARCHITECTURESSERVERLESS

(WITH INFRASTRUCTURE)AWSNiko Köbler

So�ware-Architect, Developer & Trainer

| | [email protected] www.n-k.de @dasniko

DISCLAIMERThis is silver bullet,NO

no standard, but opinionated!

This is what actually mean...serverless

It's all about the of servers!management

COMPUTE SERVERLESS MANIFESTOFunctions are the unit of deployment and scaling.No machines, VMs, or containers visible in theprogramming model.Permanent storage lives elsewhere.Scales per request; Users cannot over- or under-provision capacity.Never pay for idle (no cold servers/containers or their costs).Implicitly fault-tolerant because functions can runanywhere.BYOC - Bring Your Own Code.Metrics and logging are a universal right.

Source: various AWS presentations

AWS LAMBDAEvent Driven

JVM-based languages (Java 8), JavaScript (Node.js), Python, C#, (more to come)

Versions, Encrypted Environment Variables, Function Chaining

Pay as you use - in 100mx blocks (e.g. 100ms w/ 128MBmemory = USD 0.000000208)

AWS LAMBDA EXAMPLENODE

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

AWS LAMBDA EXAMPLEJAVA

public class ImageProcessor implements RequestHandler<S3Event, Void> { @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; } }

GATEWAYAPI"Reverse Proxy"

hides possible multiple service calls (aka "service composition", ESB?)

distributes requests to proper service instances

"Mock" services

Caching, Throttling, DDoS attack protection, etc.

GATEWAYAPI"Reverse Proxy"

hides possible multiple service calls (aka "service composition", ESB?)

distributes requests to proper service instances

"Mock" services

Caching, Throttling, DDoS attack protection, etc.

GATEWAYAPIAUTHENTICATION / AUTHORIZATION

AWS Cognito / STS

Custom Authorizer (Lambda Function, returning IAM policies)

DYNAMODBFully Managed NoSQL Data Store

Schemaless Data Model

Seamless Scalabiltiy, "no limits"

Pay by Read-/Write-Capacity-Units

SERVERLESS ARCHITECTUREWEB

SERVERLESS ARCHITECTUREWEB

TESTING

TESTINGUNIT TESTS

Functions are easy to test, stateless and little to no dependencies

TESTINGINTEGRATION TESTS

Environment, Infrastructuremax. 1000 parallel running Lambdas

COMPETITOR

GOOGLECLOUD FUNCTIONS

JavaScript

COMPETITOR

MICROSOFTAZURE FUNCTIONS

JavaScript, C#, Python, PHP

COMPETITOR

IBM BLUEMIXOPENWHISKBluemix Cloud & OnPremiseOpen Source / Apache License v2.0JavaScript (Node.js), Java (?) Python and... Swi�!Docker SupportFunction-Chaining

IBM OPENWHISK

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

DRAWBACKSOverview: Documentation, Logging & Monitoring, Metrics ! (typical things for distributed environments)

Cloud Provider Binding / Dependency: APIs, Portability, Costs, SLAs

?CURIOUSWANT TO START?

Give a try!serverless.com

Manages all the Cloud-Resources and Deployment.

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

BUT POWERFUL

SERVERLESS

No need to run/manage Application ServersFast results, minimal effort, minimal TTM(!)Low costs, minimal financial riskAutomatic Scalabiltiy and Availability "out-of-the-box"

LINKSAWS Lambda: Amazon API Gateway:

Google Cloud Functions:

Microso� Azure Functions:

IBM OpenWhisk: IBM OpenWhisk SourceCode:

Serverless Framework:

https://aws.amazon.com/lambdahttps://aws.amazon.com/api-

gateway

https://cloud.google.com/functions

https://azure.microso�.com/services/functionshttps://developer.ibm.com/openwhisk

https://github.com/openwhisk/openwhiskhttp://serverless.com