SlideShare a Scribd company logo
Serverless Computing with Google
Cloud
Wesley Chun (@wescpy)
Developer Advocate, Google
Developer Advocate, Google Cloud
● Mission: enable current and future
developers everywhere to be
successful using Google Cloud and
other Google developer tools & APIs
● Videos: host of the G Suite Dev Show
on YouTube
● Blogs: developers.googleblog.com &
gsuite-developers.googleblog.com
● Twitters: @wescpy, @GoogleDevs,
@WorkspaceDevs
G Suite Dev Show
goo.gl/JpBQ40
About the speaker
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 since
1983 (Computer Science, C, Linux, Python)
● Fellow of the Python Software Foundation
● AB (Math/CS) & CMP (Music/Piano), UC
Berkeley and MSCS, UC Santa Barbara
● Adjunct Computer Science Faculty, Foothill
College (Silicon Valley)
Agenda
1
Cloud computing
overview
2
Introduction to
Google Cloud
3
Serverless
platforms
4
Inspirational
Ideas
5
Summary &
wrap-up
Cloud computing review
All you need to know about the cloud1
What is cloud computing?
spar
Google Compute Engine, Google 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,
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
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
2 Introduction to
Google Cloud
GCP and Google Workspace (formerly
G Suite & Google Apps)
formerly
( )
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 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,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Google Cloud Platform vs. Google Workspace
Workspace
APIs
GCP
APIs
cloud.google.com/hosting-options#hosting-options
GCP compute option spectrum
Compute
Engine
Kubernetes
Engine (GKE)
Cloud Run
on Anthos
Cloud Run
(fully-mgd)
App Engine
(Flexible)
App Engine
(Standard)
Cloud
Functions
3
Run your code on
Google Cloud serverless
GCP: Google App Engine , Cloud Functions, Cloud Run
Google Workspace (formerly G Suite): Google Apps Script
> 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
○ "No worries"
○ Developers focus on writing code & solving business problems*
● Why serverless?
○ Fastest growing segment of cloud... per analyst research*:
■ $1.9B (2016) and $4.25B (2018) ⇒ $7.7B (2021) and $14.93B (2023)
○ What if you go viral? Autoscaling: your new best friend
○ What if you don't? Code not running? You're not paying.
* in USD; source:Forbes (May 2018), MarketsandMarkets™ & CB Insights (Aug 2018)
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
Why does App Engine exist?
● Focus on app not DevOps
○ Web app
○ Mobile backend
○ Cloud service
● Enhance productivity
● Deploy globally
● Fully-managed
● Auto-scaling
● Pay-per-use
● Familiar languages
● Test w/local dev server
Hello World (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
Deploy:
$ gcloud app deploy
Access globally:
PROJECT_ID.appspot.com
cloud.google.com/appengine/docs/standard/python3/quickstart
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
App Engine
"get started"
Python/Flask QuickStart tutorial
(also Java, Node.js, PHP, Go, Ruby)
Google Cloud Functions
Function-hosting in the cloud
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
○ Cmd-line or developer console (in-browser)
● Cloud Functions for Firebase
○ Mobile app use-cases
● Available runtimes
○ JS/Node.js 8, 10, 12
○ Python 3.7, 3.8
○ Go 1.11, 1.13
○ Java 11
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")
cloud.google.com/functions/docs/quickstart-python
No cmd-line
access?
Use in-browser
dev environment!
● setup
● code
● deploy
● test
Cloud Functions
"get started"
Python QuickStart tutorial
(also in Node.js & Go)
Google Cloud Run
Container-hosting in the cloud
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
Cloud Run: 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)
● GitOps: (CI/)CD Push-to-deploy from Git
StateHTTP
CONT_NAME-RANDOM_HASH-uREGION.a.run.app
Hello World (Python "MVP")
main.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)))
cloud.google.com/run/docs/quickstarts/build-and-deploy
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):
$ gcloud builds submit --tag gcr.io/PROJ_ID/CONT_NAME
Deploy (think docker run):
$ gcloud run deploy --image gcr.io/PROJ_ID/CONT_NAME --platform managed
Deploy (think docker push):
$ gcloud run deploy --image
gcr.io/PROJ_ID/CONT_NAME
--platform managed
Access globally:
CONT_NAME-RANDOM_HASH-uREG_ABBR.a.run.app
requirements.txt
Flask>=1.0.2
● Build containers easily & securely without creating/managing Dockerfiles
● Open source, open standard; based on CNCF Buildpacks spec v3
● Supports most common development tools
○ Go 1.10+
○ Node.js 10+
○ Python 3.7+
○ Java 8 & 11
○ .NET Core 3.1 +
● Blog post
○ cloud.google.com/blog/products/containers-kubernetes/google-cloud-
now-supports-buildpacks
Google Cloud buildpacks
$ ls
index.js package.json
$ gcloud alpha builds submit --pack 
image=gcr.io/my-project/my-nodejs-app
$ gcloud run deploy --image
gcr.io/my-project/my-nodejs-app
github.com/GoogleCloudPlatform/buildpacks
Cloud Run
"get started"
Python QuickStart tutorial
(also in Node.js, Go, Java, C#/.NET, Ruby, etc.)
Google Apps Script
Customized serverless JS runtime for automation, and extension
and integration with Google Workspace (formerly G Suite) and
other Google & external services
“Hello World!” in Apps Script
Sheets-bound “Hello World!”
Apps Script intro
goo.gl/1sXeuD
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
4 All of Cloud (inspiration)
Build with both GCP tools and G Suite
Custom intelligence in Gmail
Analyze Google Workspace (formerly G Suite) data with GCP
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
● 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)
Store big data results
Visualize big data results
Ingest data from Sheets
Link to chart in Sheets
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
Online resources & summary
What's available for students & educators?5
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
○ cloud.google.com/free
● Serverless Always Free tier (monthly)
○ App Engine (28 hours/day)
○ Cloud Functions & Cloud Run (2M calls/month)
● Higher education (teaching & research) grants
○ cloud.google.com/edu (credit card NOT required; expires)
○ Provides "free" usage for coursework and initial research
$$ FREE $$
Cloud computing session summary
● 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.
○ Serverless lets users focus on just their logic (apps or functions)
○ Interesting possibilities using all of Google Cloud (GCP + Workspace)
Other Google APIs & platforms
● Google Workspace (G Suite) (code Gmail, Drive, Docs, Sheets, Slides!)
○ developers.google.com/gsuite
● Firebase (mobile development platform + RT DB)
○ firebase.google.com
● Google Data Studio (data visualization, dashboards, etc.)
○ datastudio.google.com/overview
● 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
● Documentation
○ GCP: cloud.google.com/{docs,appengine,functions,run,vision,automl,translate,language,
speech,texttospeech,video-intelligence,firestore,bigquery,compute,storage,gpu,tpu}
○ G Suite: developers.google.com/{gsuite,drive,calendar,gmail,docs,sheets,slides,apps-script}
● Introductory "codelabs" (free, online, self-paced, hands-on tutorials [Python])
○ App Engine: codelabs.developers.google.com/codelabs/cloud-app-engine-python
○ Cloud Functions: codelabs.developers.google.com/codelabs/cloud-starting-cloudfunctions
○ Cloud Run: codelabs.developers.google.com/codelabs/cloud-run-hello-python3
● Other codelabs: gcplab.me (GCP) and codelabs.developers.google.com/?cat=G+Suite (G Suite)
● Videos: youtube.com/GoogleCloudPlatform (GCP) and goo.gl/JpBQ40 (G Suite)
● Code samples: github.com/GoogleCloudPlatform (GCP) and github.com/gsuitedevs (G Suite)
● Know AWS/Azure? Compare w/GCP at cloud.google.com/docs/compare/{aws,azure}
● Google Cloud serverless products: cloud.google.com/serverless
● Python on Google Cloud: cloud.google.com/python
Google Cloud references
Thank you! Questions?
Wesley Chun
@wescpy

More Related Content

What's hot (20)

PDF
Build with ALL of Google Cloud
wesley chun
 
PDF
Powerful Google Cloud tools for your hack (2020)
wesley chun
 
PDF
Easy path to machine learning (Spring 2020)
wesley chun
 
PDF
Google's serverless journey: past to present
wesley chun
 
PDF
How Google Cloud Platform can help in the classroom/lab
wesley chun
 
PDF
Introduction to serverless computing on Google Cloud
wesley chun
 
PDF
Google App Engine Overview and Update
Chris Schalk
 
PDF
Exploring Google (Cloud) APIs with Python & JavaScript
wesley chun
 
PDF
Building Kick Ass Video Games for the Cloud
Chris Schalk
 
PDF
How to build Kick Ass Games in the Cloud
Chris Schalk
 
PDF
Building Integrated Applications on Google's Cloud Technologies
Chris Schalk
 
PDF
Building Integrated Applications on Google's Cloud Technologies
Chris Schalk
 
PDF
Using Google (Cloud) APIs
wesley chun
 
PDF
Google Platform Overview (April 2014)
Ido Green
 
PDF
GDD 2011 - How to build kick ass video games for the cloud
Chris Schalk
 
PPT
Using Google Compute Engine
Lynn Langit
 
PDF
Introduction to Google Compute Engine
Colin Su
 
PDF
Deep dive into serverless on Google Cloud
Bret McGowen - NYC Google Developer Advocate
 
PDF
Google compute engine - overview
Charles Fan
 
PDF
JCConf 2016 - Google Dataflow 小試
Simon Su
 
Build with ALL of Google Cloud
wesley chun
 
Powerful Google Cloud tools for your hack (2020)
wesley chun
 
Easy path to machine learning (Spring 2020)
wesley chun
 
Google's serverless journey: past to present
wesley chun
 
How Google Cloud Platform can help in the classroom/lab
wesley chun
 
Introduction to serverless computing on Google Cloud
wesley chun
 
Google App Engine Overview and Update
Chris Schalk
 
Exploring Google (Cloud) APIs with Python & JavaScript
wesley chun
 
Building Kick Ass Video Games for the Cloud
Chris Schalk
 
How to build Kick Ass Games in the Cloud
Chris Schalk
 
Building Integrated Applications on Google's Cloud Technologies
Chris Schalk
 
Building Integrated Applications on Google's Cloud Technologies
Chris Schalk
 
Using Google (Cloud) APIs
wesley chun
 
Google Platform Overview (April 2014)
Ido Green
 
GDD 2011 - How to build kick ass video games for the cloud
Chris Schalk
 
Using Google Compute Engine
Lynn Langit
 
Introduction to Google Compute Engine
Colin Su
 
Deep dive into serverless on Google Cloud
Bret McGowen - NYC Google Developer Advocate
 
Google compute engine - overview
Charles Fan
 
JCConf 2016 - Google Dataflow 小試
Simon Su
 

Similar to Serverless Computing with Google Cloud (20)

PDF
Powerful Google developer tools for immediate impact! (2023-24 C)
wesley chun
 
PDF
Serverless computing with Google Cloud
wesley chun
 
PDF
Serverless Computing with Python
wesley chun
 
PDF
Serverless and you @ Women Who Code London 2020
Gabriela Ferrara
 
PDF
Serverless and you - where do i run my stateless code
Gabriela Ferrara
 
PPTX
Gdsc muk - innocent
junaidhasan17
 
PDF
Deploy Basic AI web apps with Serverless Computing from Google Cloud
wesley chun
 
PPTX
Google Cloud Fundamentals by CloudZone
Idan Tohami
 
PDF
Google Cloud Fundamentals
Omar Fathy
 
PDF
GCP overview
Chandan Kumar Rana
 
PPTX
Session 4 GCCP.pptx
DSCIITPatna
 
PPTX
GCCP Session 2.pptx
DSCIITPatna
 
PDF
Google Cloud Platform for Python Developer - Beginner Guide.pdf
Ridwan Fadjar
 
PDF
DevOps & SRE at Google Scale
Kaushik Bhattacharya
 
PDF
Powerful Google developer tools for immediate impact! (2023-24 A)
wesley chun
 
PDF
Dipping Your Toes Into Cloud Native Application Development
Matthew Farina
 
PDF
What is Google Cloud Platform - GDG DevFest 18 Depok
Imre Nagi
 
PPTX
Evaluating Serverless Machine Learning Performance On Google Cloud Run.pptx
Prerana Khatiwada
 
PDF
Where should I run my code? Serverless, Containers, Virtual Machines and more
Bret McGowen - NYC Google Developer Advocate
 
PPTX
GCCP-Session 2
GDSCIIITDHARWAD
 
Powerful Google developer tools for immediate impact! (2023-24 C)
wesley chun
 
Serverless computing with Google Cloud
wesley chun
 
Serverless Computing with Python
wesley chun
 
Serverless and you @ Women Who Code London 2020
Gabriela Ferrara
 
Serverless and you - where do i run my stateless code
Gabriela Ferrara
 
Gdsc muk - innocent
junaidhasan17
 
Deploy Basic AI web apps with Serverless Computing from Google Cloud
wesley chun
 
Google Cloud Fundamentals by CloudZone
Idan Tohami
 
Google Cloud Fundamentals
Omar Fathy
 
GCP overview
Chandan Kumar Rana
 
Session 4 GCCP.pptx
DSCIITPatna
 
GCCP Session 2.pptx
DSCIITPatna
 
Google Cloud Platform for Python Developer - Beginner Guide.pdf
Ridwan Fadjar
 
DevOps & SRE at Google Scale
Kaushik Bhattacharya
 
Powerful Google developer tools for immediate impact! (2023-24 A)
wesley chun
 
Dipping Your Toes Into Cloud Native Application Development
Matthew Farina
 
What is Google Cloud Platform - GDG DevFest 18 Depok
Imre Nagi
 
Evaluating Serverless Machine Learning Performance On Google Cloud Run.pptx
Prerana Khatiwada
 
Where should I run my code? Serverless, Containers, Virtual Machines and more
Bret McGowen - NYC Google Developer Advocate
 
GCCP-Session 2
GDSCIIITDHARWAD
 
Ad

More from wesley chun (15)

PDF
From zero to Google APIs: Beyond search & AI... leverage all of Google
wesley chun
 
PDF
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
wesley chun
 
PDF
Automating Google Workspace (GWS) & more with Apps Script
wesley chun
 
PDF
Easy path to machine learning (2023-2024)
wesley chun
 
PDF
Powerful Google developer tools for immediate impact! (2023-24 B)
wesley chun
 
PDF
Exploring Google APIs with Python
wesley chun
 
PDF
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
wesley chun
 
PDF
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
wesley chun
 
PDF
Easy path to machine learning (2022)
wesley chun
 
PDF
Google... more than just a cloud
wesley chun
 
PDF
Accessing Google Cloud APIs
wesley chun
 
PDF
Google Cloud @ Hackathons (2020)
wesley chun
 
PDF
Google Apps Script: Accessing G Suite & other Google services with JavaScript
wesley chun
 
PDF
Exploring Google (Cloud) APIs & Cloud Computing overview
wesley chun
 
PDF
Easy path to machine learning
wesley chun
 
From zero to Google APIs: Beyond search & AI... leverage all of Google
wesley chun
 
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
wesley chun
 
Automating Google Workspace (GWS) & more with Apps Script
wesley chun
 
Easy path to machine learning (2023-2024)
wesley chun
 
Powerful Google developer tools for immediate impact! (2023-24 B)
wesley chun
 
Exploring Google APIs with Python
wesley chun
 
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
wesley chun
 
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
wesley chun
 
Easy path to machine learning (2022)
wesley chun
 
Google... more than just a cloud
wesley chun
 
Accessing Google Cloud APIs
wesley chun
 
Google Cloud @ Hackathons (2020)
wesley chun
 
Google Apps Script: Accessing G Suite & other Google services with JavaScript
wesley chun
 
Exploring Google (Cloud) APIs & Cloud Computing overview
wesley chun
 
Easy path to machine learning
wesley chun
 
Ad

Recently uploaded (20)

PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Digital Circuits, important subject in CS
contactparinay1
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 

Serverless Computing with Google Cloud

  • 1. Serverless Computing with Google Cloud Wesley Chun (@wescpy) Developer Advocate, Google Developer Advocate, Google Cloud ● Mission: enable current and future developers everywhere to be successful using Google Cloud and other Google developer tools & APIs ● Videos: host of the G Suite Dev Show on YouTube ● Blogs: developers.googleblog.com & gsuite-developers.googleblog.com ● Twitters: @wescpy, @GoogleDevs, @WorkspaceDevs G Suite Dev Show goo.gl/JpBQ40 About the speaker 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 since 1983 (Computer Science, C, Linux, Python) ● Fellow of the Python Software Foundation ● AB (Math/CS) & CMP (Music/Piano), UC Berkeley and MSCS, UC Santa Barbara ● Adjunct Computer Science Faculty, Foothill College (Silicon Valley)
  • 2. Agenda 1 Cloud computing overview 2 Introduction to Google Cloud 3 Serverless platforms 4 Inspirational Ideas 5 Summary & wrap-up Cloud computing review All you need to know about the cloud1
  • 3. What is cloud computing? spar Google Compute Engine, Google 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, 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. 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 2 Introduction to Google Cloud GCP and Google Workspace (formerly G Suite & Google Apps)
  • 5. formerly ( ) 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 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, Cloud Datastore, NL, Vision, Pub/Sub AWS Kinesis, RDS; Windows Azure SQL, Docker Google Cloud Platform vs. Google Workspace Workspace APIs GCP APIs
  • 6. cloud.google.com/hosting-options#hosting-options GCP compute option spectrum Compute Engine Kubernetes Engine (GKE) Cloud Run on Anthos Cloud Run (fully-mgd) App Engine (Flexible) App Engine (Standard) Cloud Functions 3 Run your code on Google Cloud serverless GCP: Google App Engine , Cloud Functions, Cloud Run Google Workspace (formerly G Suite): Google Apps Script
  • 7. > 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 ○ "No worries" ○ Developers focus on writing code & solving business problems* ● Why serverless? ○ Fastest growing segment of cloud... per analyst research*: ■ $1.9B (2016) and $4.25B (2018) ⇒ $7.7B (2021) and $14.93B (2023) ○ What if you go viral? Autoscaling: your new best friend ○ What if you don't? Code not running? You're not paying. * in USD; source:Forbes (May 2018), MarketsandMarkets™ & CB Insights (Aug 2018)
  • 8. 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
  • 9. Why does App Engine exist? ● Focus on app not DevOps ○ Web app ○ Mobile backend ○ Cloud service ● Enhance productivity ● Deploy globally ● Fully-managed ● Auto-scaling ● Pay-per-use ● Familiar languages ● Test w/local dev server Hello World (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 Deploy: $ gcloud app deploy Access globally: PROJECT_ID.appspot.com cloud.google.com/appengine/docs/standard/python3/quickstart
  • 10. 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 App Engine "get started" Python/Flask QuickStart tutorial (also Java, Node.js, PHP, Go, Ruby)
  • 11. Google Cloud Functions Function-hosting in the cloud 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 ○ Cmd-line or developer console (in-browser) ● Cloud Functions for Firebase ○ Mobile app use-cases ● Available runtimes ○ JS/Node.js 8, 10, 12 ○ Python 3.7, 3.8 ○ Go 1.11, 1.13 ○ Java 11
  • 12. 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") cloud.google.com/functions/docs/quickstart-python No cmd-line access? Use in-browser dev environment! ● setup ● code ● deploy ● test
  • 13. Cloud Functions "get started" Python QuickStart tutorial (also in Node.js & Go) Google Cloud Run Container-hosting in the cloud
  • 14. 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
  • 15. Cloud Run: 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) ● GitOps: (CI/)CD Push-to-deploy from Git StateHTTP CONT_NAME-RANDOM_HASH-uREGION.a.run.app Hello World (Python "MVP") main.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))) cloud.google.com/run/docs/quickstarts/build-and-deploy
  • 16. 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): $ gcloud builds submit --tag gcr.io/PROJ_ID/CONT_NAME Deploy (think docker run): $ gcloud run deploy --image gcr.io/PROJ_ID/CONT_NAME --platform managed Deploy (think docker push): $ gcloud run deploy --image gcr.io/PROJ_ID/CONT_NAME --platform managed Access globally: CONT_NAME-RANDOM_HASH-uREG_ABBR.a.run.app requirements.txt Flask>=1.0.2 ● Build containers easily & securely without creating/managing Dockerfiles ● Open source, open standard; based on CNCF Buildpacks spec v3 ● Supports most common development tools ○ Go 1.10+ ○ Node.js 10+ ○ Python 3.7+ ○ Java 8 & 11 ○ .NET Core 3.1 + ● Blog post ○ cloud.google.com/blog/products/containers-kubernetes/google-cloud- now-supports-buildpacks Google Cloud buildpacks $ ls index.js package.json $ gcloud alpha builds submit --pack image=gcr.io/my-project/my-nodejs-app $ gcloud run deploy --image gcr.io/my-project/my-nodejs-app github.com/GoogleCloudPlatform/buildpacks
  • 17. Cloud Run "get started" Python QuickStart tutorial (also in Node.js, Go, Java, C#/.NET, Ruby, etc.) Google Apps Script Customized serverless JS runtime for automation, and extension and integration with Google Workspace (formerly G Suite) and other Google & external services
  • 18. “Hello World!” in Apps Script Sheets-bound “Hello World!” Apps Script intro goo.gl/1sXeuD
  • 19. 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('[email protected]', 'Map', 'See below.', {attachments:[map]}); } JS g.co/codelabs/apps-script-intro
  • 20. 4 All of Cloud (inspiration) Build with both GCP tools and G Suite
  • 21. Custom intelligence in Gmail Analyze Google Workspace (formerly G Suite) data with GCP
  • 22. 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
  • 23. ● 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)
  • 24. Store big data results
  • 25. Visualize big data results Ingest data from Sheets
  • 26. Link to chart in Sheets
  • 27. 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
  • 28. Online resources & summary What's available for students & educators?5 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 ○ cloud.google.com/free ● Serverless Always Free tier (monthly) ○ App Engine (28 hours/day) ○ Cloud Functions & Cloud Run (2M calls/month) ● Higher education (teaching & research) grants ○ cloud.google.com/edu (credit card NOT required; expires) ○ Provides "free" usage for coursework and initial research $$ FREE $$
  • 29. Cloud computing session summary ● 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. ○ Serverless lets users focus on just their logic (apps or functions) ○ Interesting possibilities using all of Google Cloud (GCP + Workspace) Other Google APIs & platforms ● Google Workspace (G Suite) (code Gmail, Drive, Docs, Sheets, Slides!) ○ developers.google.com/gsuite ● Firebase (mobile development platform + RT DB) ○ firebase.google.com ● Google Data Studio (data visualization, dashboards, etc.) ○ datastudio.google.com/overview ● 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
  • 30. ● Documentation ○ GCP: cloud.google.com/{docs,appengine,functions,run,vision,automl,translate,language, speech,texttospeech,video-intelligence,firestore,bigquery,compute,storage,gpu,tpu} ○ G Suite: developers.google.com/{gsuite,drive,calendar,gmail,docs,sheets,slides,apps-script} ● Introductory "codelabs" (free, online, self-paced, hands-on tutorials [Python]) ○ App Engine: codelabs.developers.google.com/codelabs/cloud-app-engine-python ○ Cloud Functions: codelabs.developers.google.com/codelabs/cloud-starting-cloudfunctions ○ Cloud Run: codelabs.developers.google.com/codelabs/cloud-run-hello-python3 ● Other codelabs: gcplab.me (GCP) and codelabs.developers.google.com/?cat=G+Suite (G Suite) ● Videos: youtube.com/GoogleCloudPlatform (GCP) and goo.gl/JpBQ40 (G Suite) ● Code samples: github.com/GoogleCloudPlatform (GCP) and github.com/gsuitedevs (G Suite) ● Know AWS/Azure? Compare w/GCP at cloud.google.com/docs/compare/{aws,azure} ● Google Cloud serverless products: cloud.google.com/serverless ● Python on Google Cloud: cloud.google.com/python Google Cloud references Thank you! Questions? Wesley Chun @wescpy