This is a half-hour technical talk on serverless computing with Google Cloud (Platform). It starts with a review of all of cloud computing then dives into serverless computing, demonstrates multiple products, and shows inspirational examples of apps built using these technologies.
1. Serverless computing
with Google Cloud:
Run apps in the cloud "without" VMs
Santa Clara/San Jose :: Fall 2023
Wesley Chun
Principal, CyberWeb
@wescpy@
Principal Consultant, CyberWeb
● Mission: produce accelerated Python
developers, enable developers to be
successful using Google Cloud and
other Google developer tools & APIs
● Focus: Python, Google Cloud (GCP) &
Google Workspace (GWS) APIs; GAE
migrations; Google X-product sol'ns
● Services: technical consulting,
training, engineering, speaking, code
samples, hands-on tutorials, public
technical content (blogs, social, etc.)
About the speaker
Previous experience / background
● Software Engineer & Developer Advocate
○ Google, Sun, HP, Cisco, EMC, Xilinx &
○ Original Yahoo!Mail engineer/SWE
● Technical trainer, teacher, instructor
○ Teaching Math, Linux, Python since '83
○ Adjunct CS Faculty at local SV colleges
● Python community member
○ Popular Core Python series author
○ Python Software Foundation Fellow
● AB (Math/CS) & CMP (Music/Piano), UC
Berkeley and MSCS, UC Santa Barbara
● Adjunct Computer Science Faculty, Foothill
College (Silicon Valley)
GWS Dev Show
goo.gl/JpBQ40
GAE migration
bit.ly/3xk2Swi
2. Serverless: why & agenda
1
Cloud computing
review
2
Introduction to
Google Cloud
3
Serverless
platforms
4
Inspiration
5
Summary
● Cloud computing has taken industry by storm (all?)
● App modernization top priority at many enterprises
○ Containerizing apps, getting them on VMs, moving to the cloud
● We can give you lots of VMs & big disk, but why serverless?
○ Serverless lets you focus on your solutions not what they run on
● Help prep next-generation (cloud-ready) workforce
01
Cloud computing review
All you need to know about the cloud
3. What is cloud computing?
spar
Google Compute Engine, Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
Cloud service levels/"pillars"
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google BigQuery, Cloud SQL, Vertex AI,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Google Apps Script
Salesforce1/force.com
Google Workspace (was G Suite/Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite, Office 365
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
4. Google Compute Engine, Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
Outsourcing of apps (SaaS)
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google BigQuery, Cloud SQL, Vertex AI,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Google Apps Script
Salesforce1/force.com
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
Google Workspace (was G Suite/Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite, Office 365
Google Compute Engine, Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
Outsourcing of hardware (IaaS)
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google BigQuery, Cloud SQL, Vertex AI,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Google Apps Script
Salesforce1/force.com
Google Workspace (was G Suite/Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite, Office 365
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
5. Google Compute Engine, Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
Outsourcing of logic-hosting (PaaS)
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google BigQuery, Cloud SQL, Vertex AI,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Google Apps Script
Salesforce1/force.com
Google Workspace (was G Suite/Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite, Office 365
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
Google BigQuery, Cloud SQL, Vertex AI,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Google Compute Engine, Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
IaaS/PaaS gray area (DataB/S/P-aaS?)
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google Apps Script
Salesforce1/force.com
Google Workspace (was G Suite/Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite, Office 365
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
6. Google Compute Engine, Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
SaaS/PaaS gray area
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google BigQuery, Cloud SQL, Vertex AI,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Google Workspace (was G Suite/Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite, Office 365
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
Google Apps Script
Salesforce1/force.com
Summary of responsibility
SaaS
Software as a Service
Applications
Data
Runtime
Middleware
OS
Virtualization
Servers
Storage
Networking
Applications
Data
Runtime
Middleware
OS
Virtualization
Servers
Storage
Networking
IaaS
Infrastructure as a Service
Applications
Data
Runtime
Middleware
OS
Virtualization
Servers
Storage
Networking
PaaS
Platform as a Service
Managed by YOU Managed by cloud vendor
Applications
Data
Runtime
Middleware
OS
Virtualization
Servers
Storage
Networking
on-prem
all you, no cloud
7. 02
All you need to
know about cloud
Google Cloud (GCP) and
Google Workspace (GWS)
formerly
( )
8. ● GWS developer home: developers.google.com/gsuite
● GWS developer intro: youtu.be/NqumcYgj5LI
● GWS REST APIs: youtu.be/2VpvWhDdXsI
● GWS Apps Script: youtu.be/xDovB0pu4OU
● Comprehensive overview: youtu.be/kkp0aNGlynw
Google Workspace
(formerly G Suite and Google Apps)
(GWS) APIs
Google Compute Engine, Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google Apps Script
Salesforce1/force.com
Google Workspace (was G Suite/Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite, Office 365
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
Google BigQuery, Cloud SQL, Vertex AI,
Cloud Firestore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Google Cloud Platform vs. Google Workspace
GWS
APIs
GCP
APIs
9. cloud.google.com/hosting-options#hosting-options
Google Cloud compute option spectrum
Compute
Engine
Kubernetes
Engine (GKE)
Cloud Run
on Anthos
Cloud Run
(fully-mgd)
App Engine
(Flexible)
App Engine
(Standard)
Cloud
Functions
03
Run your code on
Google serverless
GCP: Google App Engine, Cloud Functions,
Cloud Run and GWS: Google Apps Script
10. > Google Compute Engine configurable
VMs of all shapes & sizes, from
"micro" to 416 vCPUs, 11.776 TB
RAM, 256 TB HDD/SSD plus Google
Cloud Storage for data lake "blobs"
(Debian, CentOS, CoreOS, SUSE, Red Hat Enterprise Linux,
Ubuntu, FreeBSD; Windows Server 2008 R2, 2012 R2, 2016, 1803,
1809, 1903/2019, 1909)
cloud.google.com/compute
cloud.google.com/storage
Yeah, we got VMs & big disk… but why*?
Serverless: what & why
● What is serverless?
○ Misnomer (a "PMM") :-)
○ "No worries"
○ Developers focus on writing code & solving business problems*
○ Servers (physical & virtual) completely abstracted away from the user*
● Why serverless?
○ Fastest growing segment of cloud... per analyst research:
■ $1.9B (2016) and $4.25B (2018) ⇒ $7.7B (2021), $14.93B (2023), and $21.1B (2025)^
■ $4.18B (2018) and $6.05B (2020) ⇒ $31.53B (2026) and $53.08B (2028)†
○ What if you go viral? Autoscaling: your new best friend
○ What if you don't? Code not running? You're not paying.
* Forbes (May 2018)
^ (in USD) CB Insights (Sep 2018), MarketsandMarkets™ (Jan 2019)
† (in USD) Reports and Data (Jul 2019 , Jan 2020, and Oct 2021)
11. 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
Google Workspace (was G Suite/Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite, Office 365
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
Salesforce1/force.com
Google App Engine
App-hosting in the cloud ("Serverless 1.0")
cloud.google.com/appengine
12. Why does App Engine exist?
● Focus on code not DevOps
○ Web app or mobile backend
● Enhance productivity
● Deploy globally
● Fully-managed
● Auto-scaling
● Pay-per-use
● Familiar languages
● Test w/local dev server
● "Bundled" services like DB,
caching, tasks, storage, etc.
Hello World (Python "MVP")
app.yaml
runtime: python39
main.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello World!'
requirements.txt
flask
Deploy:
$ gcloud app deploy
Access globally:
PROJECT_ID.appspot.com
cloud.google.com/appengine/docs/standard/python3/quickstart
13. 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
Google Cloud Functions
Function-hosting in the cloud ("Serverless 2.0")
cloud.google.com/functions
14. Why does Cloud Functions exist?
● Don't have entire app?
○ No framework "overhead" (LAMP, MEAN...)
○ Deploy short utilities (alerts, ETL...), monoliths →
loosely-coupled microservices, event-driven tasks
● Event-driven
○ Triggered via HTTP or background events
■ Pub/Sub, Cloud Storage, Firebase, etc.
○ Auto-scaling & highly-available; pay per use
● Flexible development environment
○ Cmd-line or developer console (in-browser)
○ Develop/test locally with Functions Framework
● Cloud Functions for Firebase
○ Mobile app use-cases
One user's experience
15. main.py
def hello_world(request):
return 'Hello World!'
Deploy:
$ gcloud functions deploy hello --runtime python39 --trigger-http
Access globally (curl):
$ curl REGION-PROJECT_ID.cloudfunctions.net/hello
Access globally (browser):
https://REGION-PROJECT_ID.cloudfunctions.net/hello
Hello World (Python "MVP")
cloud.google.com/functions/docs/quickstart-python
Google Cloud Run
Container-hosting in the cloud ("Serverless 2.0")
cloud.run
16. The rise of containers... ● Any language
● Any library
● Any binary
● Ecosystem of base images
● Industry standard
FLEXIBILITY
“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 inaccessible for some...
CONVENIENCE
17. Cloud Run: code, build, deploy
.js .rb .go
.sh
.py ...
● Any language, library, binary
○ HTTP port, stateless
● Bundle into container
○ Build with Docker OR Cloud Build
○ Image ⇒ Container/Artifact Registry
● Deploy to Cloud Run (managed or GKE)
● GitOps: CD push-to-deploy from Git
○ See documentation & announcement
○ CI/CD with GitHub Actions tutorial
● Cloud Buildpacks: Docker, Dockerfiles,
and knowledge of containers optional
State
HTTP
Hello World (Python "MVP")
main.py
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=int(os.environ.get('PORT', 8080)))
cloud.google.com/run/docs/quickstarts/build-and-deploy
requirements.txt
flask
18. Hello World (Python "MVP")
Dockerfile
FROM python:3-slim
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
CMD ["python", "main.py"]
.dockerignore
Dockerfile
README.md
*.pyc
*.pyo
.git/
__pycache__
Build (think docker build and docker push) then deploy (think docker run):
$ gcloud builds submit --tag gcr.io/PROJ_ID/IMG_NAME
$ gcloud run deploy SVC_NAME --image gcr.io/PROJ_ID/IMG_NAME
OR… Build and Deploy (1-line combination of above commands):
$ gcloud run deploy SVC_NAME --source .
Access globally:
SVC_NAME-HASH-REG_ABBR.a.run.app
Docker &
Dockerfile
OPTIONAL!!
● Build containers easily & securely without creating/managing Dockerfiles
● Open source, open standard; based on CNCF Buildpacks spec v3
● Used by GCF Functions Framework to deploy locally-developed functions
● Supports most common development tools
○ Go 1.10+
○ Node.js 10+
○ Python 3.7+
○ Java 8 & 11
○ .NET Core 3.1+
● Blog posts
○ See cloud.google.com/blog/products/containers-kubernetes/google-cloud-now-supports-buildpacks and
cloud.google.com/blog/products/serverless/build-and-deploy-an-app-to-cloud-run-with-a-single-command
Deploy to Cloud Run with Buildpacks
github.com/GoogleCloudPlatform/buildpacks
$ ls
index.js package.json
$ gcloud run deploy myapp --source .
$ ls
main.py requirements.txt
$ gcloud run deploy myapp --source .
Node.js, Go,
Python, etc.?
It's the same
command!
19. Use case category
"Serverless 1.0" "Serverless 2.0"
App Engine
(Standard)
Cloud Run
Cloud
Functions
Web service logic-hosting
Web app hosting ✓ ✓
HTTP services ✓ ✓ ✓
Container hosting ✓
"Backoffice" (Apps and APIs)
Web & mobile backends ✓ ✓
Internal/intranet apps ✓ ✓
Automation
Large-scale data processing ✓ ✓
Workflow & orchestration ✓ ✓
Event-driven automation ✓ ✓
GitOps: Git push-to-deploy (CD) ✓
Common use cases
Serverless best practices
● Use the right tool for the job (GAE, GCF, or GCR)
● One top priority: latency
○ SOA demands fast response from components
● Second top priority: architecture
○ Breakup larger computing into components
○ Microservices, each with low latency
○ Uncouple components keeping state
20. Flexibility in options
Cloud
Functions
App
Engine
Cloud
Run
local
server
Cloud
Translation
My "Google Translate" MVP
goo.gle/2Y0ph5q
● "Nebulous" sample web app
○ Flask/Python 2 or 3
○ Express/Node.js 10+
○ Uses Cloud Translation API
● Deployable to on-prem server
● Also GCP serverless compute
○ App Engine
○ Cloud Functions
○ Cloud Run
● With only config changes
● No changes to app code
Google Apps Script
Customized serverless JS runtime for automation, and extension
and integration with Google Workspace (formerly G Suite) and
other Google & external services
22. 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
g.co/codelabs/apps-script-intro
25. Gmail message processing with GCP
Gmail
Cloud
Pub/Sub
Cloud
Functions
Cloud
Vision
Workspace
(formerly G Suite)
GCP
Star
message
Message
notification
Trigger
function
Extract
images
Categorize
images
Inbox augmented with Cloud Function
26. ● Gmail API: sets up notification forwarding to Cloud Pub/Sub
● developers.google.com/gmail/api/guides/push
● Pub/Sub: triggers logic hosted by Cloud Functions
● cloud.google.com/functions/docs/calling/pubsub
● Cloud Functions: "orchestrator" accessing GCP (and Google Workspace/G Suite) APIs
● Combine all of the above to add custom intelligence to Gmail
● Deep dive code blog post
● cloud.google.com/blog/products/application-development/
adding-custom-intelligence-to-gmail-with-serverless-on-gcp
● Application source code
● github.com/GoogleCloudPlatform/cloud-functions-gmail-nodejs
App summary
Big data analysis to slide presentation
Access GCP tools from Google Workspace (formerly G Suite)
30. Supercharge Workspace (G Suite) with GCP
Workspace (G Suite) GCP
BigQuery
Apps Script
Slides Sheets
Application
request
Big data
analytics
App summary
● Leverage GCP and build the "final mile" with Google Workspace (formerly G Suite)
● Driven by Google Apps Script
● Google BigQuery for data analysis
● Google Sheets for visualization
● Google Slides for presentable results
● "Glued" together w/Google Workspace (formerly G Suite) serverless
● Build this app (codelab): g.co/codelabs/bigquery-sheets-slides
● Video and blog post: bit.ly/2OcptaG
● Application source code: github.com/googlecodelabs/bigquery-sheets-slides
● Presented at Google Cloud NEXT (Jul 2018 [DEV229] & Apr 2019 [DEV212])
● cloud.withgoogle.com/next18/sf/sessions/session/156878
● cloud.withgoogle.com/next/sf/sessions?session=DEV212
31. 05
Wrap-up
Summary & resources
Cost of Google Cloud serverless tools
● What is free in Google Cloud overall?
○ Free Trial (credit card required; expires)
■ $300USD credit good for first 90 days
○ Always Free tier (credit card required; no expiration; subject to change)
■ Independent of Free Trial & education grants (more below)
■ Some GCP products free up to usage limits
○ Learn about both programs at cloud.google.com/free
● Serverless Always Free tier (daily or monthly quotas)
○ App Engine (28 [or 9] hours, 1GB storage & 1GB egress) per day
○ Cloud Run (2M reqs, 360k GB-secs, 180k vCPU-secs, 1GB egress) per month
○ Cloud Functions (2M calls, 400k GB-secs, 200k vCPU-secs, 5GB egress) per month
● Higher education (teaching & research) grants
○ cloud.google.com/edu (credit card NOT required; expires)
○ Provides "free" usage for coursework and initial research
$$ FREE $$
32. Summary: Google serverless computing
● Why go cloud?
○ Cloud computing has taken the world by storm
○ You're behind if you're not already using it… it's not too late!
○ Help train the next generation cloud-ready workforce!
● Google Cloud and why serverless?
○ Many features: compute, storage, AI/ML, NW, data processing, etc.
○ Modernization more than moving VMs to the cloud
○ Serverless lets users focus on just their logic (apps or functions)
○ Interesting possibilities when using >1 Google product families/APIs
Other Google APIs & platforms
● Google Workspace (G Suite) (code Gmail, Drive, Docs, Sheets, Slides!)
○ developers.google.com/gsuite
● Firebase (mobile development platform and RT DB plus ML-Kit)
○ firebase.google.com and firebase.google.com/docs/ml-kit
● Google Data Studio (data visualization, dashboards, etc.)
○ datastudio.google.com/overview
○ goo.gle/datastudio-course
● Actions on Google/Assistant/DialogFlow (voice apps)
○ developers.google.com/actions
● YouTube (Data, Analytics, and Livestreaming APIs)
○ developers.google.com/youtube
● Google Maps (Maps, Routes, and Places APIs)
○ developers.google.com/maps
● Flutter (native apps [Android, iOS, web] w/1 code base[!])
○ flutter.dev
33. Bring me to your organization
... it is my job to help you!
● "Transfer of Info" tech talks
● Half- or full-day seminars
● Hands-on "codelab" workshops
● Multi-day training courses
● Engineering consulting
● Migration strategy & planning
● cyberwebconsulting.com
● appenginemigration.com
Slides
you're looking
at them now
Work
cyberwebconsulting.com
Books
corepython.com
Blog
dev.to/wescpy
Pick a platform
youtu.be/gle26fT28Bw
Nebulous serverless
goo.gle/2Y0ph5q
youtu.be/eTotLOVR7MQ
Designing SL apps
youtu.be/ertbL2Rxbvk
Progress bars
goo.gl/69EJVw
Thank you! Questions?
Wesley Chun
Principal Consultant, CyberWeb
Python, GCP & GWS specialist
@wescpy (Tw/X, SO, GH, IG, LI)