Slide 1

Slide 1 text

@claushoefele +

Slide 2

Slide 2 text

AWS Lambda • Function as a Service, “Serverless” Architecture • ThoughtWorks: “event-triggered, ephemeral (may only last for one invocation), and fully managed by a 3rd party” • Competitors • Google Cloud Functions • MS Azure Functions • IBM OpenWhisk

Slide 3

Slide 3 text

AWS Lambda

Slide 4

Slide 4 text

Node.js child_process

Slide 5

Slide 5 text

'use strict'; const exec = require('child_process').exec; exports.handler = (event, context, callback) => { if (!event.cmd) { return callback('Please specify a command to run as event.cmd'); } const child = exec(event.cmd, (error) => { // Resolve with result of process callback(error, 'Process complete!'); }); // Log process stdout and stderr child.stdout.on('data', console.log); child.stderr.on('data', console.error); };

Slide 6

Slide 6 text

Create Swift Package Build Swift executable Capture library dependencies Run 
 integration tests with Node.js shim zip everything together Swift exec *.so zip Amazon Linux Ubuntu Ubuntu

Slide 7

Slide 7 text

Does it Work?

Slide 8

Slide 8 text

Demo

Slide 9

Slide 9 text

Pros/Cons • AWS Lambda • Limited time (5m) • Latency • Tools • Vendor lock-in • No server management • Swift on Lambda • Large file size • Logging • Ecosystem • Memory/compute efficiency

Slide 10

Slide 10 text

@claushoefele GitHub: swift-lambda-app Medium: Serverless Swift