SlideShare a Scribd company logo
1 of 22
Download to read offline
Designing flexible apps deployable to App
Engine, Cloud Functions, or Cloud Run
Wesley Chun - @wescpy
Developer Advocate, Google
Adjunct CS Faculty, Foothill College
Developer Advocate, Google Cloud
● Mission: enable current and future
developers everywhere to be
successful using Google Cloud and
other Google developer tools & APIs
● Focus: GCP serverless (App Engine,
Cloud Functions, Cloud Run); higher
education, Google Workspace, GCP
AI/ML APIs; multi-product use cases
● Content: speak to developers globally;
make videos, create code samples,
produce codelabs (free, self-paced,
hands-on tutorials), publish blog posts
About the speaker
Previous experience / background
● Software engineer & architect for 20+ years
○ Yahoo!, Sun, HP, Cisco, EMC, Xilinx
○ Original Yahoo!Mail engineer/SWE
● Technical trainer, teacher, instructor
○ Taught Math, Linux, Python since 1983
○ Private corporate trainer
○ Adjunct CS Faculty at local SV college
● 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)
Why & agenda
1
Introduction
2
Google Cloud
Serverless review
3
Nebulous, flexible
app(s)
4
Deployments
5
Summary
● Cloud computing has taken industry by storm (all?)
● App modernization top priority/key goal at many enterprises
○ Containerize apps, get them on VMs, move to cloud
● Serverless: let users focus on solutions not what they run on
● GCP: 3 (4) different serverless products for different use cases
● Similar yet different from each other, but flexible apps deployable to all
● Help prep next-generation (cloud-ready) workforce
01
Introduction
Why are you here?
Serverless: what & why
● What is serverless?
○ Misnomer (a "PMM") :-)
○ "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)
Serverless with Google
Operational
Model
Programming
Model
Low infra management Managed security Pay only for usage
Service-based
monoliths
Request +
event-driven
Open
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
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
Serverless common use cases App Engine Cloud Run
Cloud
Functions
Web services
Web app hosting/custom domains ✓ ✓
HTTP services ✓ ✓ ✓
Container hosting ✓
APIs
Web & mobile backends ✓ ✓
Internal APIs and services ✓ ✓
Data processing ✓ ✓
Automation
Workflow & orchestration ✓ ✓
Event-driven automation ✓ ✓
Common use cases
02
Google Cloud
serverless
...compute platforms review
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
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
Hello World (Python "MVP")
app.yaml
runtime: python38
main.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello World!'
requirements.txt
Flask==1.1.2
Deploy:
$ gcloud app deploy
Access globally:
PROJECT_ID.appspot.com
cloud.google.com/appengine/docs/standard/python3/quickstart
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)
○ Develop/test locally with Functions Framework
● Cloud Functions for Firebase
○ Mobile app use-cases
● Available runtimes
○ JS/Node.js 8, 10, 12, 14
○ Python 3.7, 3.8, 3.9
○ Go 1.11, 1.13
○ Java 11
○ Ruby 2.6, 2.7
○ .NET Core 3.1
main.py
def hello_world(request):
return 'Hello World!'
Deploy:
$ gcloud functions deploy hello --runtime python38 --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
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
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==1.1.2
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 combo 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
○ 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
app.py requirements.txt
$ gcloud run deploy myapp --source .
03
Nebulous, flexible app(s)
Deployable to all platforms
Flexibility in options
Cloud
Functions
App
Engine
Cloud
Run
local
server
Cloud
Translation
My "Google Translate" MVP
github.com/googlecodelabs/cloud
-nebulous-serverless-python
● "Nebulous" sample web app
○ Flask/Python app
○ Python 2 & 3 compatible
○ 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
Nebulous files
● Application files
● Configuration files
● Administrative files
○ Information files
○ Testing - CI/CD files
● Files differ per deployment
● Mainly in configuration
● Application files identical
● Administrative files not part of
deployments*
Different nebulous deployments
1. Local (or hosted) Flask server (Python 2)
2. Local (or hosted) Flask server (Python 3)
3. Google App Engine (Python 2)
4. Google App Engine (Python 3)
5. Google Cloud Functions (Python 3)
6. Google Cloud Run (Python 2 via Docker)
7. Google Cloud Run (Python 3 via Docker)
8. Google Cloud Run (Python 3 via Cloud Buildpacks)
04
Deployments
& required configuration tweaks
Local (Flask)
● Python 2 or 3
● Application files
○ main.py and templates/index.html
● Config files
○ requirements.txt (install locally; see below)
○ Service acct pub/prv key-pair & download (credentials.json)
○ Point $GOOGLE_APPLICATION_CREDENTIALS env var to ^^^^
● Run pip install -U pip -r requirements.txt
● Run python main.py
Google App Engine
● Python 2
● Application files
○ main.py and templates/index.html
● Config files
○ requirements.txt (install locally; see below)
○ app.yaml
○ appengine_config.py
● Run pip install -t lib -r requirements.txt
● Run gcloud app deploy
Google App Engine
● Python 3
● Application files
○ main.py and templates/index.html
● Config files
○ requirements.txt
○ app.yaml (uncomment runtime: python38)
● Run gcloud app deploy
Google Cloud Functions
● Python 3
● Application files
○ main.py and templates/index.html
● Config files
○ requirements.txt
● Run gcloud functions deploy translate --runtime python37
--trigger-http --allow-unauthenticated
Google Cloud Run (Docker)
● Python 2
● Application files
○ main.py and templates/index.html
● Config files
○ requirements.txt (uncomment gunicorn)
○ Dockerfile (replace ENTRYPOINT with gunicorn)
● Run gcloud beta run deploy translate
--allow-unauthenticated --platform managed --source .
Google Cloud Run (Docker)
● Python 3
● Application files
○ main.py and templates/index.html
● Config files
○ requirements.txt (uncomment gunicorn)
○ Dockerfile (use Py3 base image & gunicorn ENTRYPOINT)
● Run gcloud beta run deploy translate
--allow-unauthenticated --platform managed --source .
Google Cloud Run (Cloud Buildpacks)
● Python 3
● Application files
○ main.py and templates/index.html
● Config files
○ requirements.txt (uncomment gunicorn)
○ Procfile (replace web: with gunicorn)
● Run gcloud beta run deploy translate
--allow-unauthenticated --platform managed --source .
05
Summary
Resources & conclusion
Possible courses for this sample app
● Software Engineering
● Intro to Cloud Computing
● Machine Learning/AI
● Web application development
● Mobile app (backends)
○ Suggest Cloud Functions for Firebase (vs. GCF)
● Data science/big data
● Business applications
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 (monthly)
○ App Engine (28 [or 9] hours, 1GB storage & 1GB egress) per day
○ Cloud Run (2M reqs, 350k 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 $$
Session summary
● What's the right tool for the job?
○ GAE, GCF, GCR: they've got different use cases
○ Goal: gain familiarity with all three (learn their differences)
○ They're not as different as you may think!
● One nebulous, flexible sample web app
○ Mini "My Google Translate MVP" featuring Cloud Translation API
○ Deployable to all serverless compute platforms
○ Only requires configuration changes
○ KISS: use default service account credentials
○ github.com/googlecodelabs/cloud-nebulous-serverless-python
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
Invite me (or my team) to
your campus... it's our job!
● Faculty & grad students
● Researchers
● Undergrads
● University IT staff/CIO/CTO
● University entrepreneurship
centers/capstone project leads
Thank you! Questions?
Wesley Chun
@wescpy
Progress bars: goo.gl/69EJVw

More Related Content

What's hot

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)wesley chun
 
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)wesley chun
 
Build with ALL of Google Cloud
Build with ALL of Google CloudBuild with ALL of Google Cloud
Build with ALL of Google Cloudwesley chun
 
Google's serverless journey: past to present
Google's serverless journey: past to presentGoogle's serverless journey: past to present
Google's serverless journey: past to presentwesley chun
 
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 Cloudwesley chun
 
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)wesley chun
 
Google App Engine Overview and Update
Google App Engine Overview and UpdateGoogle App Engine Overview and Update
Google App Engine Overview and UpdateChris Schalk
 
Building Kick Ass Video Games for the Cloud
Building Kick Ass Video Games for the CloudBuilding Kick Ass Video Games for the Cloud
Building Kick Ass Video Games for the CloudChris Schalk
 
How to build Kick Ass Games in the Cloud
How to build Kick Ass Games in the CloudHow to build Kick Ass Games in the Cloud
How to build Kick Ass Games in the CloudChris Schalk
 
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/labwesley chun
 
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 TechnologiesChris Schalk
 
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 & GWTManuel Carrasco Moñino
 
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 TechnologiesChris Schalk
 
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 & JavaScriptwesley chun
 
Google Platform Overview (April 2014)
Google Platform Overview (April 2014)Google Platform Overview (April 2014)
Google Platform Overview (April 2014)Ido Green
 
Using Google (Cloud) APIs
Using Google (Cloud) APIsUsing Google (Cloud) APIs
Using Google (Cloud) APIswesley chun
 
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 GaelykGuillaume Laforge
 
Building Translate on Glass
Building Translate on GlassBuilding Translate on Glass
Building Translate on GlassTrish Whetzel
 
Rapid Application Development on Google App Engine for Java
Rapid Application Development on Google App Engine for JavaRapid Application Development on Google App Engine for Java
Rapid Application Development on Google App Engine for JavaKunal Dabir
 

What's hot (20)

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)
 
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)
 
Build with ALL of Google Cloud
Build with ALL of Google CloudBuild with ALL of Google Cloud
Build with ALL of Google Cloud
 
Google's serverless journey: past to present
Google's serverless journey: past to presentGoogle's serverless journey: past to present
Google's serverless journey: past to present
 
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
 
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)
 
Google App Engine Overview and Update
Google App Engine Overview and UpdateGoogle App Engine Overview and Update
Google App Engine Overview and Update
 
Building Kick Ass Video Games for the Cloud
Building Kick Ass Video Games for the CloudBuilding Kick Ass Video Games for the Cloud
Building Kick Ass Video Games for the Cloud
 
How to build Kick Ass Games in the Cloud
How to build Kick Ass Games in the CloudHow to build Kick Ass Games in the Cloud
How to build Kick Ass Games in the Cloud
 
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
 
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
 
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
 
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
 
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
 
Google Platform Overview (April 2014)
Google Platform Overview (April 2014)Google Platform Overview (April 2014)
Google Platform Overview (April 2014)
 
Using Google (Cloud) APIs
Using Google (Cloud) APIsUsing Google (Cloud) APIs
Using Google (Cloud) APIs
 
Deep dive into serverless on Google Cloud
Deep dive into serverless on Google CloudDeep dive into serverless on Google Cloud
Deep dive into serverless on Google Cloud
 
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
 
Building Translate on Glass
Building Translate on GlassBuilding Translate on Glass
Building Translate on Glass
 
Rapid Application Development on Google App Engine for Java
Rapid Application Development on Google App Engine for JavaRapid Application Development on Google App Engine for Java
Rapid Application Development on Google App Engine for Java
 

Similar to Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run

Accessing Google Cloud APIs
Accessing Google Cloud APIsAccessing Google Cloud APIs
Accessing Google Cloud APIswesley chun
 
Serverless computing with Google Cloud
Serverless computing with Google CloudServerless computing with Google Cloud
Serverless computing with Google Cloudwesley chun
 
Exploring Google APIs with Python
Exploring Google APIs with PythonExploring Google APIs with Python
Exploring Google APIs with Pythonwesley chun
 
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)wesley chun
 
Programming for non tech entrepreneurs
Programming for non tech entrepreneursProgramming for non tech entrepreneurs
Programming for non tech entrepreneursRodrigo Gil
 
Web App Prototypes with Google App Engine
Web App Prototypes with Google App EngineWeb App Prototypes with Google App Engine
Web App Prototypes with Google App EngineVlad Filippov
 
Google... more than just a cloud
Google... more than just a cloudGoogle... more than just a cloud
Google... more than just a cloudwesley chun
 
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 overviewwesley chun
 
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 Cloudwesley chun
 
Google app-engine-with-python
Google app-engine-with-pythonGoogle app-engine-with-python
Google app-engine-with-pythonDeepak Garg
 
Google Cloud Platform Update
Google Cloud Platform UpdateGoogle Cloud Platform Update
Google Cloud Platform UpdateIdo Green
 
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 & JavaScriptwesley chun
 
Odo improving the developer experience on OpenShift - hack & sangria
Odo   improving the developer experience on OpenShift - hack & sangriaOdo   improving the developer experience on OpenShift - hack & sangria
Odo improving the developer experience on OpenShift - hack & sangriaJorge Morales
 
Instant developer onboarding with self contained repositories
Instant developer onboarding with self contained repositoriesInstant developer onboarding with self contained repositories
Instant developer onboarding with self contained repositoriesYshay Yaacobi
 
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 JavaScriptwesley chun
 
Google App Engine for PHP
Google App Engine for PHP Google App Engine for PHP
Google App Engine for PHP Eric Johnson
 
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...wesley chun
 
GoogleDSC_ GHRCE_ flutter_firebase.pptx
GoogleDSC_ GHRCE_  flutter_firebase.pptxGoogleDSC_ GHRCE_  flutter_firebase.pptx
GoogleDSC_ GHRCE_ flutter_firebase.pptxGoogleDeveloperStude22
 

Similar to Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run (20)

Accessing Google Cloud APIs
Accessing Google Cloud APIsAccessing Google Cloud APIs
Accessing Google Cloud APIs
 
Serverless computing with Google Cloud
Serverless computing with Google CloudServerless computing with Google Cloud
Serverless computing with Google Cloud
 
Exploring Google APIs with Python
Exploring Google APIs with PythonExploring Google APIs with Python
Exploring Google APIs with Python
 
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)
 
Programming for non tech entrepreneurs
Programming for non tech entrepreneursProgramming for non tech entrepreneurs
Programming for non tech entrepreneurs
 
Web App Prototypes with Google App Engine
Web App Prototypes with Google App EngineWeb App Prototypes with Google App Engine
Web App Prototypes with Google App Engine
 
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 & Cloud Computing overview
Exploring Google (Cloud) APIs & Cloud Computing overviewExploring Google (Cloud) APIs & Cloud Computing overview
Exploring Google (Cloud) APIs & Cloud Computing overview
 
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
 
Google app-engine-with-python
Google app-engine-with-pythonGoogle app-engine-with-python
Google app-engine-with-python
 
Google Cloud Platform Update
Google Cloud Platform UpdateGoogle Cloud Platform Update
Google Cloud Platform Update
 
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
 
Odo improving the developer experience on OpenShift - hack & sangria
Odo   improving the developer experience on OpenShift - hack & sangriaOdo   improving the developer experience on OpenShift - hack & sangria
Odo improving the developer experience on OpenShift - hack & sangria
 
Google Developers Overview Deck 2015
Google Developers Overview Deck 2015Google Developers Overview Deck 2015
Google Developers Overview Deck 2015
 
Instant developer onboarding with self contained repositories
Instant developer onboarding with self contained repositoriesInstant developer onboarding with self contained repositories
Instant developer onboarding with self contained repositories
 
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
 
Google App Engine for PHP
Google App Engine for PHP Google App Engine for PHP
Google App Engine for PHP
 
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...
 
GoogleDSC_ GHRCE_ flutter_firebase.pptx
GoogleDSC_ GHRCE_  flutter_firebase.pptxGoogleDSC_ GHRCE_  flutter_firebase.pptx
GoogleDSC_ GHRCE_ flutter_firebase.pptx
 
Promise of DevOps
Promise of DevOpsPromise of DevOps
Promise of DevOps
 

More from wesley chun

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)wesley chun
 
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 Scriptwesley chun
 
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)wesley chun
 
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)wesley chun
 
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)wesley chun
 
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 APIswesley chun
 
Serverless Computing with Python
Serverless Computing with PythonServerless Computing with Python
Serverless Computing with Pythonwesley chun
 
Easy path to machine learning (2022)
Easy path to machine learning (2022)Easy path to machine learning (2022)
Easy path to machine learning (2022)wesley chun
 
Google Cloud @ Hackathons (2020)
Google Cloud @ Hackathons (2020)Google Cloud @ Hackathons (2020)
Google Cloud @ Hackathons (2020)wesley chun
 
Easy path to machine learning
Easy path to machine learningEasy path to machine learning
Easy path to machine learningwesley chun
 

More from wesley chun (10)

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)
 
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)
 
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)
 
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)
 
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 Cloud @ Hackathons (2020)
Google Cloud @ Hackathons (2020)Google Cloud @ Hackathons (2020)
Google Cloud @ Hackathons (2020)
 
Easy path to machine learning
Easy path to machine learningEasy path to machine learning
Easy path to machine learning
 

Recently uploaded

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run

  • 1. Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run Wesley Chun - @wescpy Developer Advocate, Google Adjunct CS Faculty, Foothill College Developer Advocate, Google Cloud ● Mission: enable current and future developers everywhere to be successful using Google Cloud and other Google developer tools & APIs ● Focus: GCP serverless (App Engine, Cloud Functions, Cloud Run); higher education, Google Workspace, GCP AI/ML APIs; multi-product use cases ● Content: speak to developers globally; make videos, create code samples, produce codelabs (free, self-paced, hands-on tutorials), publish blog posts About the speaker Previous experience / background ● Software engineer & architect for 20+ years ○ Yahoo!, Sun, HP, Cisco, EMC, Xilinx ○ Original Yahoo!Mail engineer/SWE ● Technical trainer, teacher, instructor ○ Taught Math, Linux, Python since 1983 ○ Private corporate trainer ○ Adjunct CS Faculty at local SV college ● 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)
  • 2. Why & agenda 1 Introduction 2 Google Cloud Serverless review 3 Nebulous, flexible app(s) 4 Deployments 5 Summary ● Cloud computing has taken industry by storm (all?) ● App modernization top priority/key goal at many enterprises ○ Containerize apps, get them on VMs, move to cloud ● Serverless: let users focus on solutions not what they run on ● GCP: 3 (4) different serverless products for different use cases ● Similar yet different from each other, but flexible apps deployable to all ● Help prep next-generation (cloud-ready) workforce 01 Introduction Why are you here?
  • 3. Serverless: what & why ● What is serverless? ○ Misnomer (a "PMM") :-) ○ "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) Serverless with Google Operational Model Programming Model Low infra management Managed security Pay only for usage Service-based monoliths Request + event-driven Open
  • 4. 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 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
  • 5. Serverless common use cases App Engine Cloud Run Cloud Functions Web services Web app hosting/custom domains ✓ ✓ HTTP services ✓ ✓ ✓ Container hosting ✓ APIs Web & mobile backends ✓ ✓ Internal APIs and services ✓ ✓ Data processing ✓ ✓ Automation Workflow & orchestration ✓ ✓ Event-driven automation ✓ ✓ Common use cases 02 Google Cloud serverless ...compute platforms review
  • 6. 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
  • 7. 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 Hello World (Python "MVP") app.yaml runtime: python38 main.py from flask import Flask app = Flask(__name__) @app.route('/') def hello(): return 'Hello World!' requirements.txt Flask==1.1.2 Deploy: $ gcloud app deploy Access globally: PROJECT_ID.appspot.com cloud.google.com/appengine/docs/standard/python3/quickstart
  • 8. 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) ○ Develop/test locally with Functions Framework ● Cloud Functions for Firebase ○ Mobile app use-cases ● Available runtimes ○ JS/Node.js 8, 10, 12, 14 ○ Python 3.7, 3.8, 3.9 ○ Go 1.11, 1.13 ○ Java 11 ○ Ruby 2.6, 2.7 ○ .NET Core 3.1
  • 9. main.py def hello_world(request): return 'Hello World!' Deploy: $ gcloud functions deploy hello --runtime python38 --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
  • 10. 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
  • 11. “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 State HTTP
  • 12. 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==1.1.2 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 combo of above commands): $ gcloud run deploy SVC_NAME --source . Access globally: SVC_NAME-HASH-REG_ABBR.a.run.app Docker & Dockerfile OPTIONAL!!
  • 13. ● 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 ○ 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 app.py requirements.txt $ gcloud run deploy myapp --source . 03 Nebulous, flexible app(s) Deployable to all platforms
  • 14. Flexibility in options Cloud Functions App Engine Cloud Run local server Cloud Translation My "Google Translate" MVP github.com/googlecodelabs/cloud -nebulous-serverless-python ● "Nebulous" sample web app ○ Flask/Python app ○ Python 2 & 3 compatible ○ 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 Nebulous files ● Application files ● Configuration files ● Administrative files ○ Information files ○ Testing - CI/CD files ● Files differ per deployment ● Mainly in configuration ● Application files identical ● Administrative files not part of deployments*
  • 15. Different nebulous deployments 1. Local (or hosted) Flask server (Python 2) 2. Local (or hosted) Flask server (Python 3) 3. Google App Engine (Python 2) 4. Google App Engine (Python 3) 5. Google Cloud Functions (Python 3) 6. Google Cloud Run (Python 2 via Docker) 7. Google Cloud Run (Python 3 via Docker) 8. Google Cloud Run (Python 3 via Cloud Buildpacks) 04 Deployments & required configuration tweaks
  • 16. Local (Flask) ● Python 2 or 3 ● Application files ○ main.py and templates/index.html ● Config files ○ requirements.txt (install locally; see below) ○ Service acct pub/prv key-pair & download (credentials.json) ○ Point $GOOGLE_APPLICATION_CREDENTIALS env var to ^^^^ ● Run pip install -U pip -r requirements.txt ● Run python main.py Google App Engine ● Python 2 ● Application files ○ main.py and templates/index.html ● Config files ○ requirements.txt (install locally; see below) ○ app.yaml ○ appengine_config.py ● Run pip install -t lib -r requirements.txt ● Run gcloud app deploy
  • 17. Google App Engine ● Python 3 ● Application files ○ main.py and templates/index.html ● Config files ○ requirements.txt ○ app.yaml (uncomment runtime: python38) ● Run gcloud app deploy Google Cloud Functions ● Python 3 ● Application files ○ main.py and templates/index.html ● Config files ○ requirements.txt ● Run gcloud functions deploy translate --runtime python37 --trigger-http --allow-unauthenticated
  • 18. Google Cloud Run (Docker) ● Python 2 ● Application files ○ main.py and templates/index.html ● Config files ○ requirements.txt (uncomment gunicorn) ○ Dockerfile (replace ENTRYPOINT with gunicorn) ● Run gcloud beta run deploy translate --allow-unauthenticated --platform managed --source . Google Cloud Run (Docker) ● Python 3 ● Application files ○ main.py and templates/index.html ● Config files ○ requirements.txt (uncomment gunicorn) ○ Dockerfile (use Py3 base image & gunicorn ENTRYPOINT) ● Run gcloud beta run deploy translate --allow-unauthenticated --platform managed --source .
  • 19. Google Cloud Run (Cloud Buildpacks) ● Python 3 ● Application files ○ main.py and templates/index.html ● Config files ○ requirements.txt (uncomment gunicorn) ○ Procfile (replace web: with gunicorn) ● Run gcloud beta run deploy translate --allow-unauthenticated --platform managed --source . 05 Summary Resources & conclusion
  • 20. Possible courses for this sample app ● Software Engineering ● Intro to Cloud Computing ● Machine Learning/AI ● Web application development ● Mobile app (backends) ○ Suggest Cloud Functions for Firebase (vs. GCF) ● Data science/big data ● Business applications 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 (monthly) ○ App Engine (28 [or 9] hours, 1GB storage & 1GB egress) per day ○ Cloud Run (2M reqs, 350k 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 $$
  • 21. Session summary ● What's the right tool for the job? ○ GAE, GCF, GCR: they've got different use cases ○ Goal: gain familiarity with all three (learn their differences) ○ They're not as different as you may think! ● One nebulous, flexible sample web app ○ Mini "My Google Translate MVP" featuring Cloud Translation API ○ Deployable to all serverless compute platforms ○ Only requires configuration changes ○ KISS: use default service account credentials ○ github.com/googlecodelabs/cloud-nebulous-serverless-python 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
  • 22. Invite me (or my team) to your campus... it's our job! ● Faculty & grad students ● Researchers ● Undergrads ● University IT staff/CIO/CTO ● University entrepreneurship centers/capstone project leads Thank you! Questions? Wesley Chun @wescpy Progress bars: goo.gl/69EJVw