SlideShare ist ein Scribd-Unternehmen logo
1 von 50
Downloaden Sie, um offline zu lesen
Google's serverless journey:
past to present
Wesley Chun
Developer Advocate, Google
Adjunct CS Faculty, Foothill College
About the speaker
Mission
● Enable current and future developers plus their technical
management everywhere to be successful using Google
Cloud and other Google developer tools & APIs.
Previous experience / background
● Software engineer & architect for 20+ years
● One of the original Yahoo!Mail engineers
● Author of bestselling "Core Python" books (corepython.com)
● Technical trainer, teacher, instructor, adjunct CS faculty
● Fellow of the Python Software Foundation
G Suite Dev Show
goo.gl/JpBQ40
Agenda & takeaways
1. Introduction
2. Platforms
3. Inspiration
4. Summary
● What+where
● How
● Why
● When
01
Introduction
Why are you here?
Serverless computing: 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
● According to pair of analyst research reports*
○ $1.9B (2016) & $4.25B (2018) ⇒ $7.7B (2021) & $14.93B (2023)
● Unless DevOps product, infrastructure less relevant for developers
● What if you go viral?
○ Autoscaling: your new best friend
● What if you don't?
○ Not running? Not incurring billing
○ Means you're not paying
○ No VMs to shutdown
○ Pay-as-you-go
* in USD; source: Research and Markets (Feb 2017) & (Aug 2018)
Serverless with Google
Operational
Model
Programming
Model
Low infra management Managed security Pay only for usage
Service-based
monoliths
Request +
event-driven
Open
Broad ecosystem
Compute
Data Analytics ML & AI
Database &
Storage
Smart
assistants &
chat
DevOps
Messaging
G Suite APIs
Top-level documentation and comprehensive developers
overview video at developers.google.com/gsuite
Google knows serverless
Google Compute Engine, Google Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
G Suite (Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
Google BigQuery, Cloud SQL,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Serverless: PaaS-y compute/processing
Google Apps Script, App Maker
Salesforce1/force.com
02
Platforms
GCP + G Suite
2008 2009 2016 2019 ???
serverless timeline
Google
App Engine
(2008; 2011)
Google
Cloud Functions
(2016; 2017; 2018)
Google
Apps Script
(2009; 2009)
Google
App Maker
(2016; 2018)
Google
Cloud Run
(2019; TBD)
Building a traditional web application
Hardware failure? Traffic spikes? Scaling? Patches &
upgrades? Network issues? License management?
How does it work?
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
● 2nd gen std platforms
○ Python 3.7
○ Java 8, 11
○ PHP 7.2
○ Go 1.11
○ JS/Node.js 8, 10
○ Ruby 2.5
Not all apps user-facing or web-based!!
● Need backend processing? Want to build your own?
● No UI required... just need HTTP
● Optimal for user info (high scores, contacts, levels/badges, etc.)
● Better UI: move user data off phone so it's universally available
App Engine as mobile backend
● Pulse news mobile app
○ Built in 6 short weeks by founders (2010)
○ Use of App Engine cost-effective
○ 30MM+ users, 10MM+ stories read/day
○ Thousands of QPS, 100M daily requests
● Awards
○ Apple’s App Store Hall of Fame
○ Time Magazine’s Top 50 iOS apps
● Acquired & integrated into LinkedIn (2015)
● More on Pulse
○ blog.linkedin.com/2015/06/17/introducing-the-new-linkedin-
pulse-your-daily-news-powered-by-your-professional-world
○ googleappengine.blogspot.com/2011/11/scaling-with-kindle-fire.html
○ cloud.google.com/files/Pulse.pdf
Gaming & scaling
Popular App Engine Use Cases
● Mobile/Tablet
○ App backends
○ Cloud persistence
● Social/Mobile Games
○ Speed, scale
○ API integrations
○ Personals/dating
● Consumer Web Apps
○ Unpredictable traffic
○ Scale (up or down)
● Apps in Academia
○ Any course where students
build web or mobile apps
○ Research projects
○ IT/Operational apps
● Business Apps
○ Enterprise
○ Java runtime
○ IT/Operational apps
○ Web or Mobile
Hello World (3 files: Python "MVP")
app.yaml
runtime: python37
main.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello World!'
requirements.txt
Flask==1.0.2
Open source repo at
github.com/GoogleCloudPlatform/python-docs-samples/
tree/master/appengine/standard_python37/hello_world
How to deploy and where to run it
$ gcloud app deploy
● Browser
● cURL
● Mobile apps (backend, no UI needed!)
● etc.
Access globally at:
https://PROJECT_ID.appspot.com
App Engine demo
Python Flask QuickStart tutorial
(also Java, Node.js, PHP, Go, Ruby)
2008 2009 2016 2019 ???
serverless timeline
Google
App Engine
(2008; 2011)
Google
Cloud Functions
(2016; 2017; 2018)
Google
Apps Script
(2009; 2009)
Google
App Maker
(2016; 2018)
Google
Cloud Run
(2019; TBD)
Why does Cloud Functions exist?
● Don't have entire app?
○ No framework "overhead" (LAMP, MEAN...)
○ Deploy microservices
● Event-driven
○ Triggered via HTTP or background events
■ Pub/Sub, Cloud Storage, Firebase, etc.
○ Auto-scaling & highly-available; pay per use
● Flexible development environment
○ Node.js/JavaScript, Python, Go, Java
○ Deploy from cmd-line or developer console
● Cloud Functions for Firebase
○ Mobile app use-cases
Create, Deploy, Trigger
Deploying
● Create locally then deploy on cmd-line OR
● Edit and deploy from developer web console
Triggering (in response to events)
● HTTP — via HTTP request
● Cloud Storage — bucket object/metadata CRUD
● Cloud Pub/Sub — new message
● Firebase (DB, Storage, Analytics, Auth)
Available runtimes
● Node.js 6, 8, 10 (JS)
● Python 3.7
● Go 1.11, 1.12
● Java 8
BOLD == preview release
To create a function
Create function code locally then deploy on cmd-line
OR
1. Go to developer console @ console.cloud.google.com
2. Select a project (or create new one)
3. Choose Cloud Functions, then "Create Function"
4. Select name, memory, trigger type, language, etc.
5. Write code in browser then click to deploy (and test)
Events and triggers
Events trigger cloud functions to execute. A trigger is the type of event
that's recognized for any specific function. Functions can only be bound to
1 trigger type at a time.
EVENTS (i.e., functions are invoked when…)
1. HTTP — via HTTP request
2. Cloud Storage — bucket object/metadata CRUD
3. Cloud Pub/Sub — new message
4. Firebase (DB, Storage, Analytics, Auth)
5. Direct — CLI or developer console requests
6. others
Setting cloud function trigger type
Trigger Command-line flag
HTTP --trigger-http
Cloud Storage --trigger-bucket BUCKET_NAME
Cloud Pub/Sub --trigger-topic TOPIC_NAME
Other sources (e.g. Firebase) --trigger-event EVENT_TYPE
--trigger-resource RESOURCE
main.py
def hello_world(request):
return 'Hello World!'
Deploy:
$ gcloud functions deploy hello --runtime python37 --trigger-http
Access globally (curl):
curl -X POST https://GCP_REGION-PROJECT_ID.cloudfunctions.net/hello 
-H "Content-Type:application/json"
Access globally (browser):
GCP_REGION-PROJECT_ID.cloudfunctions.net/hello
Hello World (Python "MVP")
No cmd-line
access?
Use in-browser
dev environment!
● setup
● code
● deploy
● test
Google Cloud Functions pricing
Resource/unit Cost
0-2 million calls FREE
2+ million calls $0.0000004/ea (40¢ per million)
GB-Second* $0.0000025
GHz-Second* $0.0000100
Outbound data $0.12/GB (5 GB/mo. free)
Inbound data, outbound data
to Google in same region
FREE
*GB-second == 1 second of wallclock time w/1GB of memory provisioned
GHz-second == 1 second of wallclock time with a 1GHz CPU provisioned
Cloud Functions demo
Python GCF QuickStart tutorial
(also in Node.js & Go)
2008 2009 2016 2019 ???
serverless timeline
Google
App Engine
(2008; 2011)
Google
Cloud Functions
(2016; 2017; 2018)
Google
Apps Script
(2009; 2009)
Google
App Maker
(2016; 2018)
Google
Cloud Run
(2019; TBD)
+JavaScript
-API “flavor”
+built-in
“flavor”
-OAuth2 (you)
!=
Google Apps Script is a serverless
JavaScript runtime for automation,
extension, and integration with G Suite,
Google, or other external services.
“
”
Spreadsheets… any magic functions?
Sure, how about GOOGLEFINANCE()?
Spreadsheets… can you code them?
Sure, if you know where to look...
“Hello World!” in Apps Script
Sheets-bound “Hello World!”
Apps Script intro
goo.gl/1sXeuD
Combining your code & ours
But I want (to write) my own function!
Creating my own ("custom") function!
Bitcoin sample
bit.ly/2kMbH1C
Woo-hoo… using my own function!
What can you do with this?
Accessing maps from
spreadsheets?!?
goo.gl/oAzBN9
This… with help from Google Maps & Gmail
function sendMap() {
var sheet = SpreadsheetApp.getActiveSheet();
var address = sheet.getRange("A2").getValue();
var map = Maps.newStaticMap().addMarker(address);
GmailApp.sendEmail('friend@example.com', 'Map',
'See below.', {attachments:[map]});
}
JS
● Extend functionality of G Suite editors
● Embed your app within ours!
● 2014: Google Docs, Sheets, Forms
● 2017 Q3: Google Slides
● 2017 Q4: Gmail
● 2018 Q1: Hangouts Chat bots
● Apps Script also powers App Maker,
Google Data Studio community
connectors, and Google Ads scripts
Apps Script powers add-ons… and more!
Making progress (bars) with Slides Add-ons
var BAR_ID = 'PROGRESS_BAR_ID';
var BAR_HEIGHT = 10; // px
var presentation = SlidesApp.getActivePresentation();
function createBars() {
var slides = presentation.getSlides();
deleteBars();
for (var i = 0; i < slides.length; ++i) {
var ratioComplete = (i / (slides.length - 1));
var x = 0;
var y = presentation.getPageHeight() - BAR_HEIGHT;
var barWidth = presentation.getPageWidth() * ratioComplete;
if (barWidth > 0) {
var bar = slides[i].insertShape(SlidesApp.ShapeType.RECTANGLE,
x, y, barWidth, BAR_HEIGHT);
bar.getBorder().setTransparent();
bar.setLinkUrl(BAR_ID);
}
}
}
Progress bars
goo.gl/69EJVw
Making progress (bars) with Slides Add-ons
Expense
reports...
● Expense reports
● Can't we do them
without leaving Gmail?
● On Web AND mobile?
● At your desk or on the road
● One place to complete
your expense report
● One code base
Gmail Add-ons
Expediting expense
reports
goo.gl/KUVCDu
● Not just for conversations
● Create microservice utilities
● Build chat bots to...
○ Automate workflows
○ Query for information
○ Other heavy-lifting
Hangouts Chat bots
(bot framework and API)
function onMessage(e) {
return createMessage(e.user.displayName, 0);
}
function onCardClick(e) {
// Create a new vote card when 'NEW' button is clicked.
if (e.action.actionMethodName === 'newvote') {
return createMessage(e.user.displayName, 0);
}
// Updates the card in-place when '+1' or '-1' button is clicked.
var voteCount = +e.action.parameters[0].value;
e.action.actionMethodName === 'upvote' ? ++voteCount : --voteCount;
return createMessage(e.user.displayName, voteCount, true);
}
Simple vote bot
}, {
textButton: {
text: '-1',
onClick: {
action: {
actionMethodName: 'downvote',
parameters: parameters
}
}
}
}, {
textButton: {
text: 'NEW',
onClick: {
action: {
actionMethodName: 'newvote'
}
}
}
}]
}]
}]
}]
};
}
function createMessage(voter, voteCount, shouldUpdate) {
var parameters = [{key: 'count', value: voteCount.toString()}];
return {
actionResponse: {
type: shouldUpdate ? 'UPDATE_MESSAGE' : 'NEW_MESSAGE'
},
cards: [{
header: {
title: 'Last vote by ' + voter + '!'
},
sections: [{
widgets: [{
textParagraph: {
text: voteCount + ' votes!'
}
}, {
buttons: [{
textButton: {
text: '+1',
onClick: {
action: {
actionMethodName: 'upvote',
parameters: parameters
}
}
}
Hangouts Chat bots
goo.gl/jt3FqK
Vote bot interactive card
function onMessage(e) {
return createMessage(e.user.displayName, 0);
}
function onCardClick(e) {
// Create a new vote card when 'NEW' button is clicked.
if (e.action.actionMethodName === 'newvote') {
return createMessage(e.user.displayName, 0);
}
// Updates the card in-place when '+1' or '-1' button is clicked.
var voteCount = +e.action.parameters[0].value;
e.action.actionMethodName === 'upvote' ? ++voteCount : --voteCount;
return createMessage(e.user.displayName, voteCount, true);
}
Simple vote bot
JavaScript: Google Apps Script
Hangouts Chat bots
goo.gl/jt3FqK
● Command-line interface
● Intergrate with git plus
your local IDE/dev env.
● Actions
○ Create
○ Pull
○ Push
○ Clone
○ Deploy
○ View logs
● Built on Apps Script API
● Launched early 2018
Professional workflow with clasp tool
2008 2009 2016 2019 ???
serverless timeline
Google
App Engine
(2008; 2011)
Google
Cloud Functions
(2016; 2017; 2018)
Google
Apps Script
(2009; 2009)
Google
App Maker
(2016; 2018)
Google
Cloud Run
(2019; TBD)
Got app licenses for sales,
marketing & operations?
BUT...
Who builds my app?
If no resources, how
do I do it myself?
Custom business apps: still no easy solutions
Who will pay
for it?
What platform
should I use?
Where do I host
my data?
Is my app
compliant?
Who has access
to my app?
● 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
Google App Maker
Operational / Process
Employee directory
Room scheduling
Budget tracking
Project & task tracking
Meeting planning
Security dashboard
Travel approvals
Line of Business (LOB)
Lender limits
Inventory management
Content management
Legal contracts
Student progress
Custom apps across use-cases
2008 2009 2016 2019 ???
serverless timeline
Google
App Engine
(2008; 2011)
Google
Cloud Functions
(2016; 2017; 2018)
Google
Apps Script
(2009; 2009)
Google
App Maker
(2016; 2018)
Google
Cloud Run
(2019; TBD)
The rise of containers ● Any language
● Any library
● Any binary
● Ecosystem of base images
● Industry standard
“We can’t be locked in.”
“How can we use
existing binaries?”
“Why do I have to choose between
containers and serverless?”
“Can you support language _______ ?”
Serverless not accessible to everyone...
● 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 Kubernetes cluster (GKE)
○ Or your self-managed Kubernetes cluster
Google Cloud Run to the rescue!
Code, build, deploy
.js .rb .go
.sh.py ...
● Any language, library, binary
○ HTTP port, stateless
● Bundle into container
○ Build w/Docker OR
○ Google Cloud Build
○ Image ⇒ Container Registry
● Deploy to Cloud Run (managed or GKE)
StateHTTP
https://yourservice.run.app
Hello World (3 files: Python "MVP")
Dockerfile
FROM python:3.7
ENV APP_HOME /app
ENV TARGET MHacks2019
WORKDIR $APP_HOME
COPY . .
RUN pip install Flask gunicorn
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 app:app
cloud.google.com/run/docs/quickstarts/build-and-deploy or
github.com/knative/docs/tree/master/docs/serving/samples/h
ello-world/helloworld-python
.dockerignore
Dockerfile
README.md
*.pyc
*.pyo
*.pyd
__pycache__
Hello World (3 files: Python "MVP")
app.py
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
target = os.environ.get('TARGET', 'World')
return 'Hello {}!'.format(target)
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=int(os.environ.get('PORT', 8080)))
Hello World (3 files: Python "MVP")
Build (think docker build):
$ gcloud builds submit --tag gcr.io/PROJ_ID/CONT_NAME
Deploy (think docker push):
$ gcloud beta run deploy --image 
gcr.io/PROJ_ID/CONT_NAME --platform managed
Access globally:
https://CONT_NAME-RANDOM_HASH-uc.a.run.app
Cloud Run demo
GCR QuickStart tutorials
(also in Node.js, Go, Java, C#/.NET,
Ruby, Kotlin, Swift, Dart, Rust)
Serverless
functions
Serverless
applications
Serverless
HTTP workloads
Source-based
HTTP and events
Source-based
HTTP and async
Cloud
Functions
App Engine
Cloud Run
GCP serverless compute options summary
Containers
HTTP and async
03
Inspiration
Sample apps & case studies
Custom intelligence in Gmail
Analyze G Suite data with GCP
Gmail message processing with GCP
Gmail
Cloud
Pub/Sub
Cloud
Functions
Cloud
Vision
G Suite GCP
Star
message
Message
notification
Trigger
function
Extract
images
Categorize
images
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
G Suite GCP
BigQuery
Apps Script
Slides Sheets
Application
request
Big data
analytics
Hangouts Chat Productivity Tracker
Chat bot that's GCP & G Suite aware
Productivity tracker Hangouts Chat bot
G Suite GCP
Sheets Natural Language
START
or LOG
END
Hangouts
Chat
App
Engine
Cloud
SQL
App summary
● Motivation
● Do coding contract jobs during school year
● Needed to track time spent on work (and non-work)
● Who doesn't want to be more productive?
● Hangouts Chat bot framework & API... build bots to:
● Automate workflows
● Query for information
● Other heavy-lifting
● G Suite app that leverages app-hosting, NL processing, and storage tools from GCP
● Application source code
● github.com/gsuitedevs/hangouts-chat-samples/tree/master/python/productivity_tracker
● Presented at GDG Silicon Valley (Aug 2018)
● meetup.com/gdg-silicon-valley/events/252858660
04
What's Next?
Summary
● Serverless: organizations can focus on solving problems, not infrastructure
● Managed app-/service-hosting, or container-hosting for ultimate flexibility
● Google knows serverless
○ Over a decade of experience: been doing it before term existed
○ Variety of products serving different business needs
○ cloud.google.com/serverless and developers.google.com/gsuite
● 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
Know AWS? Compare with GCP here:
cloud.google.com/docs/compare/aws
Serverless computing: opinionated
logic-hosting containers in the cloud.
Thank you!
Wesley Chun
@wescpy
Progress bars: goo.gl/69EJVw

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Powerful Google Cloud tools for your hack
Powerful Google Cloud tools for your hackPowerful Google Cloud tools for your hack
Powerful Google Cloud tools for your hack
 
Easy path to machine learning (Spring 2021)
Easy path to machine learning (Spring 2021)Easy path to machine learning (Spring 2021)
Easy path to machine learning (Spring 2021)
 
Exploring Google APIs with Python
Exploring Google APIs with PythonExploring Google APIs with Python
Exploring Google APIs with Python
 
Rapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWTRapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWT
 
How Google Cloud Platform can help in the classroom/lab
How Google Cloud Platform can help in the classroom/labHow Google Cloud Platform can help in the classroom/lab
How Google Cloud Platform can help in the classroom/lab
 
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
 
Easy path to machine learning (Spring 2020)
Easy path to machine learning (Spring 2020)Easy path to machine learning (Spring 2020)
Easy path to machine learning (Spring 2020)
 
Mobile backends with Google Cloud Platform (MBLTDev'14)
Mobile backends with Google Cloud Platform (MBLTDev'14)Mobile backends with Google Cloud Platform (MBLTDev'14)
Mobile backends with Google Cloud Platform (MBLTDev'14)
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and Gaelyk
 
Introduction to Google Cloud Endpoints: Speed Up Your API Development
Introduction to Google Cloud Endpoints: Speed Up Your API DevelopmentIntroduction to Google Cloud Endpoints: Speed Up Your API Development
Introduction to Google Cloud Endpoints: Speed Up Your API Development
 
Google App Engine Overview and Update
Google App Engine Overview and UpdateGoogle App Engine Overview and Update
Google App Engine Overview and Update
 
Building Integrated Applications on Google's Cloud Technologies
Building Integrated Applications on Google's Cloud TechnologiesBuilding Integrated Applications on Google's Cloud Technologies
Building Integrated Applications on Google's Cloud Technologies
 
Google Cloud Functions & Firebase Crash Course
Google Cloud Functions & Firebase Crash CourseGoogle Cloud Functions & Firebase Crash Course
Google Cloud Functions & Firebase Crash Course
 
Gentle App Engine Intro
Gentle App Engine IntroGentle App Engine Intro
Gentle App Engine Intro
 
Google App Engine (Introduction)
Google App Engine (Introduction)Google App Engine (Introduction)
Google App Engine (Introduction)
 
Devfest09 App Engine Java
Devfest09  App Engine  JavaDevfest09  App Engine  Java
Devfest09 App Engine Java
 
Gradle: One technology to build them all
Gradle: One technology to build them allGradle: One technology to build them all
Gradle: One technology to build them all
 
Introduction to android studio 2.0 and data binding library
Introduction to android studio 2.0 and data binding libraryIntroduction to android studio 2.0 and data binding library
Introduction to android studio 2.0 and data binding library
 
Lesson 1. Create project Sunshine
Lesson 1. Create project SunshineLesson 1. Create project Sunshine
Lesson 1. Create project Sunshine
 
Google Home and Google Assistant Workshop: Build your own serverless Action o...
Google Home and Google Assistant Workshop: Build your own serverless Action o...Google Home and Google Assistant Workshop: Build your own serverless Action o...
Google Home and Google Assistant Workshop: Build your own serverless Action o...
 

Ähnlich wie Google's serverless journey: past to present

Ähnlich wie Google's serverless journey: past to present (20)

Introduction to serverless computing on Google Cloud
Introduction to serverless computing on Google CloudIntroduction to serverless computing on Google Cloud
Introduction to serverless computing on Google Cloud
 
Serverless computing with Google Cloud
Serverless computing with Google CloudServerless computing with Google Cloud
Serverless computing with Google Cloud
 
Google Cloud Platform Update
Google Cloud Platform UpdateGoogle Cloud Platform Update
Google Cloud Platform Update
 
Google Technical Webinar - Building Mashups with Google Apps and SAP, using S...
Google Technical Webinar - Building Mashups with Google Apps and SAP, using S...Google Technical Webinar - Building Mashups with Google Apps and SAP, using S...
Google Technical Webinar - Building Mashups with Google Apps and SAP, using S...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Accessing Google Cloud APIs
Accessing Google Cloud APIsAccessing Google Cloud APIs
Accessing Google Cloud APIs
 
Powerful Google developer tools for immediate impact! (2023-24 A)
Powerful Google developer tools for immediate impact! (2023-24 A)Powerful Google developer tools for immediate impact! (2023-24 A)
Powerful Google developer tools for immediate impact! (2023-24 A)
 
Powerful Google Cloud tools for your hack (2020)
Powerful Google Cloud tools for your hack (2020)Powerful Google Cloud tools for your hack (2020)
Powerful Google Cloud tools for your hack (2020)
 
Google Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScriptGoogle Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScript
 
Cloud computing overview & Technical intro to Google Cloud
Cloud computing overview & Technical intro to Google CloudCloud computing overview & Technical intro to Google Cloud
Cloud computing overview & Technical intro to Google Cloud
 
Cloud computing overview & running your code on Google Cloud
Cloud computing overview & running your code on Google CloudCloud computing overview & running your code on Google Cloud
Cloud computing overview & running your code on Google Cloud
 
Exploring Google APIs with Python
Exploring Google APIs with PythonExploring Google APIs with Python
Exploring Google APIs with Python
 
Exploring Google (Cloud) APIs & Cloud Computing overview
Exploring Google (Cloud) APIs & Cloud Computing overviewExploring Google (Cloud) APIs & Cloud Computing overview
Exploring Google (Cloud) APIs & Cloud Computing overview
 
G Suite & Google APIs coding workshop
G Suite & Google APIs coding workshopG Suite & Google APIs coding workshop
G Suite & Google APIs coding workshop
 
Cloud computing overview & running your code on Google Cloud (Jun 2019)
Cloud computing overview & running your code on Google Cloud (Jun 2019)Cloud computing overview & running your code on Google Cloud (Jun 2019)
Cloud computing overview & running your code on Google Cloud (Jun 2019)
 
Google Developers Overview Deck 2015
Google Developers Overview Deck 2015Google Developers Overview Deck 2015
Google Developers Overview Deck 2015
 
Google Platform Overview (April 2014)
Google Platform Overview (April 2014)Google Platform Overview (April 2014)
Google Platform Overview (April 2014)
 
Google Cloud @ Hackathons (2020)
Google Cloud @ Hackathons (2020)Google Cloud @ Hackathons (2020)
Google Cloud @ Hackathons (2020)
 
Powerful Google developer tools for immediate impact! (2023-24 B)
Powerful Google developer tools for immediate impact! (2023-24 B)Powerful Google developer tools for immediate impact! (2023-24 B)
Powerful Google developer tools for immediate impact! (2023-24 B)
 
Building a scalable app factory with Appcelerator Platform
Building a scalable app factory with Appcelerator PlatformBuilding a scalable app factory with Appcelerator Platform
Building a scalable app factory with Appcelerator Platform
 

Mehr von wesley chun

Mehr von wesley chun (10)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Easy path to machine learning (2023-2024)
Easy path to machine learning (2023-2024)Easy path to machine learning (2023-2024)
Easy path to machine learning (2023-2024)
 
Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)
 
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
 
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
Exploring Google APIs 102: Cloud vs. non-GCP Google APIsExploring Google APIs 102: Cloud vs. non-GCP Google APIs
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
 
Serverless Computing with Python
Serverless Computing with PythonServerless Computing with Python
Serverless Computing with Python
 
Easy path to machine learning (2022)
Easy path to machine learning (2022)Easy path to machine learning (2022)
Easy path to machine learning (2022)
 
Google... more than just a cloud
Google... more than just a cloudGoogle... more than just a cloud
Google... more than just a cloud
 
Exploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScriptExploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScript
 
Easy path to machine learning
Easy path to machine learningEasy path to machine learning
Easy path to machine learning
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Kürzlich hochgeladen (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Google's serverless journey: past to present

  • 1. Google's serverless journey: past to present Wesley Chun Developer Advocate, Google Adjunct CS Faculty, Foothill College About the speaker Mission ● Enable current and future developers plus their technical management everywhere to be successful using Google Cloud and other Google developer tools & APIs. Previous experience / background ● Software engineer & architect for 20+ years ● One of the original Yahoo!Mail engineers ● Author of bestselling "Core Python" books (corepython.com) ● Technical trainer, teacher, instructor, adjunct CS faculty ● Fellow of the Python Software Foundation G Suite Dev Show goo.gl/JpBQ40
  • 2. Agenda & takeaways 1. Introduction 2. Platforms 3. Inspiration 4. Summary ● What+where ● How ● Why ● When 01 Introduction Why are you here?
  • 3. Serverless computing: 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)
  • 4. Serverless: the why ● Fastest growing segment of cloud ● According to pair of analyst research reports* ○ $1.9B (2016) & $4.25B (2018) ⇒ $7.7B (2021) & $14.93B (2023) ● Unless DevOps product, infrastructure less relevant for developers ● What if you go viral? ○ Autoscaling: your new best friend ● What if you don't? ○ Not running? Not incurring billing ○ Means you're not paying ○ No VMs to shutdown ○ Pay-as-you-go * in USD; source: Research and Markets (Feb 2017) & (Aug 2018) Serverless with Google Operational Model Programming Model Low infra management Managed security Pay only for usage Service-based monoliths Request + event-driven Open
  • 5. Broad ecosystem Compute Data Analytics ML & AI Database & Storage Smart assistants & chat DevOps Messaging
  • 6. G Suite APIs Top-level documentation and comprehensive developers overview video at developers.google.com/gsuite Google knows serverless
  • 7. Google Compute Engine, Google Cloud Storage AWS EC2 & S3; Rackspace; Joyent SaaS Software as a Service PaaS Platform as a Service IaaS Infrastructure as a Service G Suite (Google Apps) Yahoo!Mail, Hotmail, Salesforce, Netsuite Google App Engine, Cloud Functions Heroku, Cloud Foundry, Engine Yard, AWS Lambda Google BigQuery, Cloud SQL, Cloud Datastore, NL, Vision, Pub/Sub AWS Kinesis, RDS; Windows Azure SQL, Docker Serverless: PaaS-y compute/processing Google Apps Script, App Maker Salesforce1/force.com 02 Platforms GCP + G Suite
  • 8. 2008 2009 2016 2019 ??? serverless timeline Google App Engine (2008; 2011) Google Cloud Functions (2016; 2017; 2018) Google Apps Script (2009; 2009) Google App Maker (2016; 2018) Google Cloud Run (2019; TBD) Building a traditional web application Hardware failure? Traffic spikes? Scaling? Patches & upgrades? Network issues? License management?
  • 9. How does it work? Why does App Engine exist?
  • 10. App Engine to the rescue!! ● Focus on app not DevOps ● Enhance productivity ● Deploy globally ● Fully-managed ● Auto-scaling ● Pay-per-use ● Familiar standard runtimes ● 2nd gen std platforms ○ Python 3.7 ○ Java 8, 11 ○ PHP 7.2 ○ Go 1.11 ○ JS/Node.js 8, 10 ○ Ruby 2.5 Not all apps user-facing or web-based!! ● Need backend processing? Want to build your own? ● No UI required... just need HTTP ● Optimal for user info (high scores, contacts, levels/badges, etc.) ● Better UI: move user data off phone so it's universally available
  • 11. App Engine as mobile backend ● Pulse news mobile app ○ Built in 6 short weeks by founders (2010) ○ Use of App Engine cost-effective ○ 30MM+ users, 10MM+ stories read/day ○ Thousands of QPS, 100M daily requests ● Awards ○ Apple’s App Store Hall of Fame ○ Time Magazine’s Top 50 iOS apps ● Acquired & integrated into LinkedIn (2015) ● More on Pulse ○ blog.linkedin.com/2015/06/17/introducing-the-new-linkedin- pulse-your-daily-news-powered-by-your-professional-world ○ googleappengine.blogspot.com/2011/11/scaling-with-kindle-fire.html ○ cloud.google.com/files/Pulse.pdf Gaming & scaling
  • 12. Popular App Engine Use Cases ● Mobile/Tablet ○ App backends ○ Cloud persistence ● Social/Mobile Games ○ Speed, scale ○ API integrations ○ Personals/dating ● Consumer Web Apps ○ Unpredictable traffic ○ Scale (up or down) ● Apps in Academia ○ Any course where students build web or mobile apps ○ Research projects ○ IT/Operational apps ● Business Apps ○ Enterprise ○ Java runtime ○ IT/Operational apps ○ Web or Mobile Hello World (3 files: Python "MVP") app.yaml runtime: python37 main.py from flask import Flask app = Flask(__name__) @app.route('/') def hello(): return 'Hello World!' requirements.txt Flask==1.0.2 Open source repo at github.com/GoogleCloudPlatform/python-docs-samples/ tree/master/appengine/standard_python37/hello_world
  • 13. How to deploy and where to run it $ gcloud app deploy ● Browser ● cURL ● Mobile apps (backend, no UI needed!) ● etc. Access globally at: https://PROJECT_ID.appspot.com App Engine demo Python Flask QuickStart tutorial (also Java, Node.js, PHP, Go, Ruby)
  • 14. 2008 2009 2016 2019 ??? serverless timeline Google App Engine (2008; 2011) Google Cloud Functions (2016; 2017; 2018) Google Apps Script (2009; 2009) Google App Maker (2016; 2018) Google Cloud Run (2019; TBD) Why does Cloud Functions exist? ● Don't have entire app? ○ No framework "overhead" (LAMP, MEAN...) ○ Deploy microservices ● Event-driven ○ Triggered via HTTP or background events ■ Pub/Sub, Cloud Storage, Firebase, etc. ○ Auto-scaling & highly-available; pay per use ● Flexible development environment ○ Node.js/JavaScript, Python, Go, Java ○ Deploy from cmd-line or developer console ● Cloud Functions for Firebase ○ Mobile app use-cases
  • 15. Create, Deploy, Trigger Deploying ● Create locally then deploy on cmd-line OR ● Edit and deploy from developer web console Triggering (in response to events) ● HTTP — via HTTP request ● Cloud Storage — bucket object/metadata CRUD ● Cloud Pub/Sub — new message ● Firebase (DB, Storage, Analytics, Auth) Available runtimes ● Node.js 6, 8, 10 (JS) ● Python 3.7 ● Go 1.11, 1.12 ● Java 8 BOLD == preview release
  • 16. To create a function Create function code locally then deploy on cmd-line OR 1. Go to developer console @ console.cloud.google.com 2. Select a project (or create new one) 3. Choose Cloud Functions, then "Create Function" 4. Select name, memory, trigger type, language, etc. 5. Write code in browser then click to deploy (and test) Events and triggers Events trigger cloud functions to execute. A trigger is the type of event that's recognized for any specific function. Functions can only be bound to 1 trigger type at a time. EVENTS (i.e., functions are invoked when…) 1. HTTP — via HTTP request 2. Cloud Storage — bucket object/metadata CRUD 3. Cloud Pub/Sub — new message 4. Firebase (DB, Storage, Analytics, Auth) 5. Direct — CLI or developer console requests 6. others
  • 17. Setting cloud function trigger type Trigger Command-line flag HTTP --trigger-http Cloud Storage --trigger-bucket BUCKET_NAME Cloud Pub/Sub --trigger-topic TOPIC_NAME Other sources (e.g. Firebase) --trigger-event EVENT_TYPE --trigger-resource RESOURCE main.py def hello_world(request): return 'Hello World!' Deploy: $ gcloud functions deploy hello --runtime python37 --trigger-http Access globally (curl): curl -X POST https://GCP_REGION-PROJECT_ID.cloudfunctions.net/hello -H "Content-Type:application/json" Access globally (browser): GCP_REGION-PROJECT_ID.cloudfunctions.net/hello Hello World (Python "MVP")
  • 18. No cmd-line access? Use in-browser dev environment! ● setup ● code ● deploy ● test Google Cloud Functions pricing Resource/unit Cost 0-2 million calls FREE 2+ million calls $0.0000004/ea (40¢ per million) GB-Second* $0.0000025 GHz-Second* $0.0000100 Outbound data $0.12/GB (5 GB/mo. free) Inbound data, outbound data to Google in same region FREE *GB-second == 1 second of wallclock time w/1GB of memory provisioned GHz-second == 1 second of wallclock time with a 1GHz CPU provisioned
  • 19. Cloud Functions demo Python GCF QuickStart tutorial (also in Node.js & Go) 2008 2009 2016 2019 ??? serverless timeline Google App Engine (2008; 2011) Google Cloud Functions (2016; 2017; 2018) Google Apps Script (2009; 2009) Google App Maker (2016; 2018) Google Cloud Run (2019; TBD)
  • 20. +JavaScript -API “flavor” +built-in “flavor” -OAuth2 (you) != Google Apps Script is a serverless JavaScript runtime for automation, extension, and integration with G Suite, Google, or other external services. “ ”
  • 21. Spreadsheets… any magic functions? Sure, how about GOOGLEFINANCE()?
  • 22. Spreadsheets… can you code them? Sure, if you know where to look...
  • 23. “Hello World!” in Apps Script Sheets-bound “Hello World!” Apps Script intro goo.gl/1sXeuD
  • 24. Combining your code & ours But I want (to write) my own function!
  • 25. Creating my own ("custom") function! Bitcoin sample bit.ly/2kMbH1C Woo-hoo… using my own function!
  • 26. What can you do with this? Accessing maps from spreadsheets?!? goo.gl/oAzBN9 This… with help from Google Maps & Gmail function sendMap() { var sheet = SpreadsheetApp.getActiveSheet(); var address = sheet.getRange("A2").getValue(); var map = Maps.newStaticMap().addMarker(address); GmailApp.sendEmail('friend@example.com', 'Map', 'See below.', {attachments:[map]}); } JS
  • 27. ● Extend functionality of G Suite editors ● Embed your app within ours! ● 2014: Google Docs, Sheets, Forms ● 2017 Q3: Google Slides ● 2017 Q4: Gmail ● 2018 Q1: Hangouts Chat bots ● Apps Script also powers App Maker, Google Data Studio community connectors, and Google Ads scripts Apps Script powers add-ons… and more!
  • 28. Making progress (bars) with Slides Add-ons var BAR_ID = 'PROGRESS_BAR_ID'; var BAR_HEIGHT = 10; // px var presentation = SlidesApp.getActivePresentation(); function createBars() { var slides = presentation.getSlides(); deleteBars(); for (var i = 0; i < slides.length; ++i) { var ratioComplete = (i / (slides.length - 1)); var x = 0; var y = presentation.getPageHeight() - BAR_HEIGHT; var barWidth = presentation.getPageWidth() * ratioComplete; if (barWidth > 0) { var bar = slides[i].insertShape(SlidesApp.ShapeType.RECTANGLE, x, y, barWidth, BAR_HEIGHT); bar.getBorder().setTransparent(); bar.setLinkUrl(BAR_ID); } } } Progress bars goo.gl/69EJVw Making progress (bars) with Slides Add-ons
  • 29. Expense reports... ● Expense reports ● Can't we do them without leaving Gmail? ● On Web AND mobile? ● At your desk or on the road ● One place to complete your expense report ● One code base Gmail Add-ons Expediting expense reports goo.gl/KUVCDu
  • 30. ● Not just for conversations ● Create microservice utilities ● Build chat bots to... ○ Automate workflows ○ Query for information ○ Other heavy-lifting Hangouts Chat bots (bot framework and API) function onMessage(e) { return createMessage(e.user.displayName, 0); } function onCardClick(e) { // Create a new vote card when 'NEW' button is clicked. if (e.action.actionMethodName === 'newvote') { return createMessage(e.user.displayName, 0); } // Updates the card in-place when '+1' or '-1' button is clicked. var voteCount = +e.action.parameters[0].value; e.action.actionMethodName === 'upvote' ? ++voteCount : --voteCount; return createMessage(e.user.displayName, voteCount, true); } Simple vote bot
  • 31. }, { textButton: { text: '-1', onClick: { action: { actionMethodName: 'downvote', parameters: parameters } } } }, { textButton: { text: 'NEW', onClick: { action: { actionMethodName: 'newvote' } } } }] }] }] }] }; } function createMessage(voter, voteCount, shouldUpdate) { var parameters = [{key: 'count', value: voteCount.toString()}]; return { actionResponse: { type: shouldUpdate ? 'UPDATE_MESSAGE' : 'NEW_MESSAGE' }, cards: [{ header: { title: 'Last vote by ' + voter + '!' }, sections: [{ widgets: [{ textParagraph: { text: voteCount + ' votes!' } }, { buttons: [{ textButton: { text: '+1', onClick: { action: { actionMethodName: 'upvote', parameters: parameters } } } Hangouts Chat bots goo.gl/jt3FqK Vote bot interactive card function onMessage(e) { return createMessage(e.user.displayName, 0); } function onCardClick(e) { // Create a new vote card when 'NEW' button is clicked. if (e.action.actionMethodName === 'newvote') { return createMessage(e.user.displayName, 0); } // Updates the card in-place when '+1' or '-1' button is clicked. var voteCount = +e.action.parameters[0].value; e.action.actionMethodName === 'upvote' ? ++voteCount : --voteCount; return createMessage(e.user.displayName, voteCount, true); } Simple vote bot JavaScript: Google Apps Script Hangouts Chat bots goo.gl/jt3FqK
  • 32. ● Command-line interface ● Intergrate with git plus your local IDE/dev env. ● Actions ○ Create ○ Pull ○ Push ○ Clone ○ Deploy ○ View logs ● Built on Apps Script API ● Launched early 2018 Professional workflow with clasp tool 2008 2009 2016 2019 ??? serverless timeline Google App Engine (2008; 2011) Google Cloud Functions (2016; 2017; 2018) Google Apps Script (2009; 2009) Google App Maker (2016; 2018) Google Cloud Run (2019; TBD)
  • 33. Got app licenses for sales, marketing & operations? BUT... Who builds my app? If no resources, how do I do it myself? Custom business apps: still no easy solutions Who will pay for it? What platform should I use? Where do I host my data? Is my app compliant? Who has access to my app?
  • 34. ● 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 Google App Maker Operational / Process Employee directory Room scheduling Budget tracking Project & task tracking Meeting planning Security dashboard Travel approvals Line of Business (LOB) Lender limits Inventory management Content management Legal contracts Student progress Custom apps across use-cases
  • 35. 2008 2009 2016 2019 ??? serverless timeline Google App Engine (2008; 2011) Google Cloud Functions (2016; 2017; 2018) Google Apps Script (2009; 2009) Google App Maker (2016; 2018) Google Cloud Run (2019; TBD) The rise of containers ● Any language ● Any library ● Any binary ● Ecosystem of base images ● Industry standard
  • 36. “We can’t be locked in.” “How can we use existing binaries?” “Why do I have to choose between containers and serverless?” “Can you support language _______ ?” Serverless not accessible to everyone... ● 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 Kubernetes cluster (GKE) ○ Or your self-managed Kubernetes cluster Google Cloud Run to the rescue!
  • 37. Code, build, deploy .js .rb .go .sh.py ... ● Any language, library, binary ○ HTTP port, stateless ● Bundle into container ○ Build w/Docker OR ○ Google Cloud Build ○ Image ⇒ Container Registry ● Deploy to Cloud Run (managed or GKE) StateHTTP https://yourservice.run.app Hello World (3 files: Python "MVP") Dockerfile FROM python:3.7 ENV APP_HOME /app ENV TARGET MHacks2019 WORKDIR $APP_HOME COPY . . RUN pip install Flask gunicorn CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 app:app cloud.google.com/run/docs/quickstarts/build-and-deploy or github.com/knative/docs/tree/master/docs/serving/samples/h ello-world/helloworld-python .dockerignore Dockerfile README.md *.pyc *.pyo *.pyd __pycache__
  • 38. Hello World (3 files: Python "MVP") app.py import os from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): target = os.environ.get('TARGET', 'World') return 'Hello {}!'.format(target) if __name__ == '__main__': app.run(debug=True, host='0.0.0.0', port=int(os.environ.get('PORT', 8080))) Hello World (3 files: Python "MVP") Build (think docker build): $ gcloud builds submit --tag gcr.io/PROJ_ID/CONT_NAME Deploy (think docker push): $ gcloud beta run deploy --image gcr.io/PROJ_ID/CONT_NAME --platform managed Access globally: https://CONT_NAME-RANDOM_HASH-uc.a.run.app
  • 39. Cloud Run demo GCR QuickStart tutorials (also in Node.js, Go, Java, C#/.NET, Ruby, Kotlin, Swift, Dart, Rust) Serverless functions Serverless applications Serverless HTTP workloads Source-based HTTP and events Source-based HTTP and async Cloud Functions App Engine Cloud Run GCP serverless compute options summary Containers HTTP and async
  • 40. 03 Inspiration Sample apps & case studies Custom intelligence in Gmail Analyze G Suite data with GCP
  • 41. Gmail message processing with GCP Gmail Cloud Pub/Sub Cloud Functions Cloud Vision G Suite GCP Star message Message notification Trigger function Extract images Categorize images
  • 42. Inbox augmented with Cloud Function Big data analysis to slide presentation Access GCP tools from G Suite
  • 43.
  • 44. Store big data results Visualize big data results
  • 45. Ingest data from Sheets Link to chart in Sheets
  • 46. Supercharge G Suite with GCP G Suite GCP BigQuery Apps Script Slides Sheets Application request Big data analytics
  • 47. Hangouts Chat Productivity Tracker Chat bot that's GCP & G Suite aware Productivity tracker Hangouts Chat bot G Suite GCP Sheets Natural Language START or LOG END Hangouts Chat App Engine Cloud SQL
  • 48. App summary ● Motivation ● Do coding contract jobs during school year ● Needed to track time spent on work (and non-work) ● Who doesn't want to be more productive? ● Hangouts Chat bot framework & API... build bots to: ● Automate workflows ● Query for information ● Other heavy-lifting ● G Suite app that leverages app-hosting, NL processing, and storage tools from GCP ● Application source code ● github.com/gsuitedevs/hangouts-chat-samples/tree/master/python/productivity_tracker ● Presented at GDG Silicon Valley (Aug 2018) ● meetup.com/gdg-silicon-valley/events/252858660
  • 49. 04 What's Next? Summary ● Serverless: organizations can focus on solving problems, not infrastructure ● Managed app-/service-hosting, or container-hosting for ultimate flexibility ● Google knows serverless ○ Over a decade of experience: been doing it before term existed ○ Variety of products serving different business needs ○ cloud.google.com/serverless and developers.google.com/gsuite ● 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 Know AWS? Compare with GCP here: cloud.google.com/docs/compare/aws
  • 50. Serverless computing: opinionated logic-hosting containers in the cloud. Thank you! Wesley Chun @wescpy Progress bars: goo.gl/69EJVw