SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run...
-
Upload
duongkhanh -
Category
Documents
-
view
219 -
download
0
Transcript of SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run...
![Page 1: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/1.jpg)
ARCHITECTURES(WITH INFRASTRUCTURE)
Niko Köbler So�ware-Architect, Developer & Trainer
| |
SERVERLESS
AWS
[email protected] www.n-k.de @dasniko
![Page 3: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/3.jpg)
DISCLAIMERThis is silver bullet,
no standard, but opinionated!
NO
![Page 7: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/7.jpg)
![Page 8: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/8.jpg)
![Page 9: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/9.jpg)
Serverless is about the of servers.
Build and run applications servers.
management
without thinkingabout
![Page 10: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/10.jpg)
OF COMPUTINGPhysical Servers in datacentersVirtual Machines in datacentersVirtual Machines in CloudContainers on Virtual MachinesServerless as the unit of compute
EVOLUTION
![Page 11: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/11.jpg)
COMPUTE Functions 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.
SERVERLESS MANIFESTO
![Page 12: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/12.jpg)
Source: various AWS presentations
![Page 14: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/14.jpg)
PaaS FaaSis as
DevOps NoOps
vs.
vs.
![Page 16: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/16.jpg)
AWS Event Driven
JVM-based languages (Java 8), JavaScript (Node.js), Python, C#, (more to come)
Versions, Encrypted Environment Variables, Step Functions
Pay as you use - in 100ms blocks (e.g. 100ms w/ 128MB memory = USD 0.000000208)
LAMBDA
![Page 17: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/17.jpg)
AWS EXAMPLE
LAMBDANODE
exports.handler = (event, context) => { console.log('Received event:', JSON.stringify(event)); }
![Page 18: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/18.jpg)
AWS EXAMPLE
LAMBDAJAVA
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; } }
![Page 19: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/19.jpg)
AWS EVENTSS3
Cloud Watch
Config
AWS IoT
Cognito
SES
API Gateway
(no complete list)
LAMBDA
DynamoDB
Cloud Formation
Kinesis
Code Commit
SNS
Echo / Alexa
Cron
![Page 21: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/21.jpg)
GATEWAY"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.
API
![Page 23: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/23.jpg)
![Page 24: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/24.jpg)
GATEWAY"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.
API
![Page 25: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/25.jpg)
GATEWAYAUTHENTICATION / AUTHORIZATION
AWS Cognito / STS
Custom Authorizer (Lambda Function, returning IAM policies)
API
![Page 26: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/26.jpg)
API GATEWAY AUTHORIZATION
![Page 28: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/28.jpg)
![Page 30: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/30.jpg)
DYNAMOFully Managed NoSQL Data Store
Schemaless Data Model
Seamless Scalabiltiy, "no limits"
Pay by Read-/Write-Capacity-Units
DB
![Page 34: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/34.jpg)
![Page 35: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/35.jpg)
![Page 36: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/36.jpg)
API Gateway with , Push and SNS SQS
![Page 37: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/37.jpg)
![Page 39: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/39.jpg)
TESTING
![Page 40: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/40.jpg)
TESTING
Functions are easy to test, stateless and little to no dependencies
UNIT TESTS
![Page 41: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/41.jpg)
TESTING
Environment, Infrastructuremax. 1024 of running processes/threads
max. 100 concurrent Lambdas per Region no remote debugging
INTEGRATION TESTS
![Page 44: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/44.jpg)
MICROSOFTAZURE FUNCTIONS
JavaScript, C#, Python, PHP
COMPETITOR
![Page 46: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/46.jpg)
COMPETITOR
IBM BLUEMIX
Bluemix Cloud & OnPremiseOpen Source / Apache License v2.0JavaScript (Node.js), Python and... Swi�!Docker SupportFunction-Chaining
OPENWHISK
![Page 47: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/47.jpg)
IBM
LET'S GET STARTEDOPENWHISK
$ git clone https://github.com/openwhisk/openwhisk.git $ cd openwhisk/tools/vagrant $ vagrant up
![Page 48: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/48.jpg)
IBM JAVASCRIPT EXAMPLE
Create the action in OpenWhisk
Run the action
Result
OPENWHISK
function main(params) { return {payload: 'Hello, ' + params.name}; }
$ wsk action create hello hello.js
$ wsk action invoke hello --blocking --result --param name Niko
{ "payload": "Hello, Niko" }
![Page 49: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/49.jpg)
![Page 50: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/50.jpg)
Overview: Documentation, Logging & Monitoring, Metrics ! (typical things for distributed environments)
Cloud Provider Binding / Dependency: APIs, Portability, Costs, SLAs
DRAWBACKS
![Page 51: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/51.jpg)
?WANT TO START?
Give a try!
Manages all the Cloud-Resources and Deployment.
CURIOUS
serverless.com
![Page 52: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/52.jpg)
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
![Page 53: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/53.jpg)
BUT POWERFUL
No need to run/manage Application ServersFast results, minimal effort, minimal TTM(!)Low costs, minimal financial riskAutomatic Scalabiltiy and Availability "out-of-the-box"
SERVERLESS
![Page 54: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/54.jpg)
THANK !ANY ?
Slides:
Niko Köbler So�ware-Architect, Developer & Trainer
| |
YOUQUESTIONS
http://bit.ly/serverless-slides
[email protected] www.n-k.de @dasniko
![Page 55: SERVERLESS ARCHITECTURES - Entwicklertag · Ser verless is about the of ser vers. Build and run applications ser vers. management without thinking about](https://reader031.fdocuments.us/reader031/viewer/2022022015/5b502fc77f8b9a5a6f8df586/html5/thumbnails/55.jpg)
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