Slide 1

Slide 1 text

Building a Serverless Cloud Service John Chang Python Porto #10

Slide 2

Slide 2 text

A Little Context AWS EC2 2015 2010 2005 2000 ☁ JSON REST AJAX

Slide 3

Slide 3 text

A Little Context Heroku Google App Engine AWS EB PaaS IaaS 2015 2010 2005 2000 ☁ AWS EC2

Slide 4

Slide 4 text

A Little Context Heroku Google App Engine AWS EB FaaS AWS Lambda GC Functions Azure Functions 2015 2010 2005 2000 PaaS IaaS ☁ AWS EC2

Slide 5

Slide 5 text

• Serverless Computation == FaaS • … also Serverless Databases • “Serverless” means transparent scaling What is Serverless? FaaS AWS Lambda GC Functions Azure Functions

Slide 6

Slide 6 text

Example “Hello World” on AWS Lambda

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

So What? • Zero admin • Truly transparent scaling • No vendor lock-in • Lower costs ☁ { }

Slide 11

Slide 11 text

FaaS Pricing • Billed by 1) GB-second rate + 2) Cost per request • 128 MB × (1 GB/1024 MB) × 100 ms × (1 s/1000 ms) = 0.0125 GB-s • 400,000 GB-s, 1M requests free per month

Slide 12

Slide 12 text

• More abstraction • More systems complexity • Latency • Vendor lock-in (sort of…) So What? • Zero admin • Transparent scaling • No vendor lock-in • Lower costs ☁ { }

Slide 13

Slide 13 text

FaaS Platforms AWS Lambda Supported Python 2.7, 3.6, 3.7 ✅ Google Cloud Functions Beta Python 3.7.1 ⚠ Azure Functions Experimental (1.x), N/A (2.x)

Slide 14

Slide 14 text

FaaS Use Cases • Event-oriented, short-lived (minutes) execution 1. Trigger 2. Data pipeline 3. API service

Slide 15

Slide 15 text

Trigger • On-demand or scheduled tasks Action Lambda Event { }

Slide 16

Slide 16 text

Ex: Lunchbot Action Lambda Event Post to Slack webhook Scrape Instagram, Build notification Daily timer { }

Slide 17

Slide 17 text

Ex: Newsbot Action Lambda Event Post to backend Query news feeds and apply filters Hourly timer { }

Slide 18

Slide 18 text

Ex: Server Health Alarms Action Lambda Event Post to Slack webhook Build notification Environment health check { }

Slide 19

Slide 19 text

Data Pipeline • Real-time log/file/media processing • e.g. resize and compress image upon upload Lambda Sink Storage Source { }

Slide 20

Slide 20 text

Ex: Server Log Analytics • Can be used with AWS Athena (“serverless” SQL) Lambda Sink Storage Source Parse user agent strings Post to Kinesis Firehose Web server access logs Write to S3 { }

Slide 21

Slide 21 text

API Service • Microservices, Proxy backends Lambda API Gateway Data Store Client { }

Slide 22

Slide 22 text

Ex: Proxy Backend Lambda API Gateway Data Store Client Rewrite responses Listen for requests Web app frontend Third-party API service { }

Slide 23

Slide 23 text

Example SURFnCODE Lunchbot

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

Ex: Lunchbot Action Lambda Event Post to Slack webhook Scrape Instagram, Build notification Daily timer { }

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

• Serverless Computation == FaaS • … also Serverless Databases • “Serverless” means transparent scaling What is Serverless? FaaS AWS Lambda GC Functions Azure Functions

Slide 38

Slide 38 text

What is SURFnCODE? • Startup-that-makes-startups • Based in Matosinhos • *+,-./012345 • We’re hiring! 6 careers.surfncode.io (even Python newbies)