's serverless journey: past to present

Wesley Chun (@wescpy) Sr. Developer Advocate, Google Spring 2019

About the speaker

Mission ● Enable current and future developers and their technical management everywhere to be successful using Google Cloud and other Google developer tools & APIs.

Previous experience / background ● Softwareengineer & architect for 20+ years ● One of the original Yahoo!Mail engineers G Suite Dev Show ● Author of bestselling "Core Python" books (corepython.com) goo.gl/JpBQ40 ● Technical trainer, teacher, instructor, adjunct CS faculty ● Fellow of the Python Software Foundation Agenda & takeaways

● Introduction ● What ● Platforms ● How ● Inspiration ● Why ● Summary ● When

Introduction Why are you here? 01 Serverless computing means opinionated logic-hosting containers in the cloud.

Serverless: the what ● Misnomer ● "No worries" ● According to Forbes*: ○ Developers focus on writing code & solving business problems without having to worry about infrastructure. ○ Servers (physical & virtual) completely abstracted away from the user.

* source: Forbes (May 2018) Serverless: the why

● Fastest growing segment of cloud* ● $1.9B (2016) and $4.25B (2018) ⇒ $7.7B (2021) and $14.93B (2023) ● What if you go viral? ● What if you don't?

* in USD; source: Research and Markets (Feb 2017) & (Aug 2018)

Broad ecosystem

Database & Storage

Data Analytics ML & AI

Compute

Smart Messaging assistants & chat

DevOps G Suite APIs Google knows serverless

serverless timeline

Google App Maker (2009; 2009) (2016; 2018)

2008 2009 2016 2019 ???

Google Google Cloud Functions Cloud Run (2008; 2011) (2016; 2017; 2018) (2019; TBD) Platforms GCP + G Suite 02

Google App Engine App-hosting in the cloud Why does App Engine exist?

App Engine to the rescue!!

● Focus on app not DevOps ● Enhance productivity ● Deploy globally ● Fully-managed ● Auto-scaling ● Pay-per-use ● Familiar standard runtimes Hello World (3 : Python "MVP") app.yaml runtime: python37 main.py from flask import Flask Deploy: app = Flask(__name__) $ gcloud app deploy

@app.route('/') Access globally: def hello(): return 'Hello World!' https://PROJECT_ID.appspot.com requirements.txt Flask==1.0.2

Popular App Engine use-cases

● Mobile/tablet ● Consumer web apps ○ App backends ○ Unpredictable traffic ○ Cloud persistence ○ Scale (up or down)

● Social/gaming ● Business apps ○ Speed, scale ○ Enterprise ○ API integrations ○ Java & PHP runtimes ○ Personals/dating ○ Web or mobile Google Cloud Functions Function-hosting in the cloud

Why does Cloud Functions exist?

● Don't have full app ○ No framework "overhead" (LAMP, MEAN...) ○ Microservices ● Event-driven ○ Triggered via HTTP or background events ○ Auto-scaling & highly-available ○ Pay per use ● Familiar development environment ○ Cmd-line or developer console ● Cloud Functions for Hello World (Python "MVP") main.py def hello_world(request): return 'Hello World!'

Deploy: $ gcloud functions deploy hello --runtime python37 --trigger-http

Access globally: https://GCP_REGION-PROJECT_ID.cloudfunctions.net/hello Google Apps Script Customized JS runtime for automation, extension, and integration with G Suite and other Google or external services

Sheets-bound “Hello World!” Sheets-bound “Hello World!”

Apps Script intro goo.gl/1sXeuD

What can you do with this? This… with help from & function sendMap() { JS var sheet = SpreadsheetApp.getActiveSheet(); var address = sheet.getRange("A2").getValue(); var map = Maps.newStaticMap().addMarker(address); GmailApp.sendEmail('[email protected]', 'Map', 'See below.', {attachments:[map]}); }

Accessing maps from spreadsheets?!? goo.gl/oAzBN9 Google App Maker Low-code assistive development for custom business apps

Got app licenses for sales, marketing & operations?

BUT... Custom business apps: still no easy solutions

What platform Who has access should I use? to my app?

Who builds my app? If no resources, how do I do it myself?

Is my app compliant?

Who will pay Where do I host for it? my data?

Google App Maker

● Low-code assistive development environment; Cloud SQL default ● Go from idea to app in minutes ● Drag-n-drop app building ● Many pre-made template apps ● Generates Apps Script code ● Requires at least G Suite Business Custom apps across use-cases

Line of Business (LOB) Operational / Process

Employee directory Lender limits

Room scheduling Inventory management

Budget tracking Content management

Project & task tracking Legal contracts

Meeting planning Student progress

Security dashboard

Travel approvals

Google Cloud Run Container-hosting in the cloud The rise of containers ● Any language ● Any library ● Any binary ● Ecosystem of base images ● Industry standard

Serverless not accessible to everyone...

“Can you support language ______?” “How can we use existing binaries?”

“We can’t be locked in.” “Why do I have to choose between containers and serverless?” Google Cloud Run to the rescue!

● Fully-managed serverless "CaaS" ○ Flexibility and portability of containers, but with the convenience of serverless ○ You app, your bundled container ○ Auto-scale, -provision, -config ○ Pay-per-use ● Anti-vendor lock-in, portable to: ○ Google-managed cluster (GKE) ○ Or your self-managed Kubernetes cluster

.js .rb .go Code, build, deploy .py .sh ...

● Any language, library, binary ○ HTTP port, stateless ● Bundle into container HTTP State ○ Build w/Docker or ○ Google Cloud Build ○ From Container Registry... ● Deploy to Cloud Run

https://yourservice.run.app Inspiration Sample apps & case studies 03

Custom intelligence in Gmail Analyze G Suite data with GCP Gmail message processing with GCP

Star message

Categorize images

Message Cloud Trigger Cloud Extract Cloud notification Pub/Sub function Functions images Vision Gmail

G Suite GCP Inbox augmented with Cloud Function

Big data analysis to slide presentation Access GCP tools from G Suite Store big data results Visualize big data results

Ingest data from Sheets Link to chart in Sheets Supercharge G Suite with GCP

Application Apps Script request

Big data analytics BigQuery

Slides Sheets

G Suite GCP What's Next? 04 Summary ● Google knows serverless ○ Over a decade of experience ○ Been doing it before term existed ○ Variety of products serving different business needs ● Inspiration ○ Big data-to-slide deck: bit.ly/2OcptaG ○ Gmail intelligence: cloud.google.com/blog/products/application- development/adding-custom-intelligence-to-gmail-with-serverless-on-gcp ● Products ○ 2008: cloud.google.com/appengine ○ 2009: developers.google.com/apps-script ○ 2016: cloud.google.com/functions ○ 2016: gsuite.google.com/appmaker ○ 2019: cloud.google.com/run

Thank you!

Wesley Chun @wescpy

Progress bars: goo.gl/69EJVw