This is a 15-20 minute tech talk designed for those who wish to get a broad high-level introduction to serverless computing. Tech featured includes Google App Engine, Google Cloud Functions, and Google Apps Script.
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
Â
Introduction to Serverless Computing on Google Cloud
1. Introduction to serverless
computing on Google Cloud
Wesley Chun
Developer Advocate, Google
Contribute
questions at:
goo.gl/Rq6ABI
G Suite Dev Show
goo.gl/JpBQ40
About the speaker
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,
@GSuiteDevs
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. Serverless: what & why
â—Ź What is serverless?
â—‹ Misnomer: of course there's a server somewhere
â—‹ You just don't have to worry about it!
â—‹ Forbes (May 2018): Serverless... [helps] developers focus on writing code without having to
worry about infrastructure... servers (physical & virtual) completely abstracted away from the
user. [Developers] ... focused on solving business problems (e.g., faster app deployment)
â—Ź Why serverless?
â—‹ Fastest growing segment of cloud... per 2 analysts*:
■$1.9B (2016) and $4.25B (2018) ⇒ $7.7B (2021) and $14.93B (2023)
â—‹ Unless focused on DevOps... VMs, networking, load balancing, web servers,
database servers, frontends/proxies, etc. less relevant for app-builders
â—‹ What if you go viral? Autoscaling: your new best friend
â—‹ What if you don't? Code not running? You're not paying. (No VMs to shutdown.)
* in USD; source: 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
G Suite (Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
Google BigQuery, Cloud SQL,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL Database
Serverless: PaaS-y compute/processing
Google Apps Script, App Maker
Salesforce1/force.com
4. App Engine to the rescue!!
â—ŹEasy to build
â—ŹEasy to manage
â—ŹEasy to scale
â—Ź Enables greater developer productivity!
â—Ź Focus on building your app, not sys admin
â—Ź Let us wear the pagers!
â—Ź BUT don't confuse App Engine w/IaaS services!
Not all apps user-facing or web-based!!
â—Ź Need backend server processing? Want to build your own?
â—Ź No UI needed for app to talk to App Engine, just need HTTP
â—Ź Great place for user info e.g., high scores, contacts, levels/badges, etc.
â—Ź Better UI: move user data off phone & make universally available
5. Hello World (3 files)
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
App hosting plus a domain name!
$ gcloud app deploy
browser URL:
https://APP_ID.appspot.com
Ex: https://wescpy-apitest.appspot.com
How to deploy and where to run it
$ gcloud app deploy
â—Ź Browser
â—Ź cURL
â—Ź Mobile apps (backend, no UI needed!)
â—Ź etc.
browser URL:
https://APP_ID.appspot.com
Ex: https://wescpy-apitest.appspot.com
6. Languages supported
Languages
â—Ź Python 2.7 & 3.6
â—Ź Node.js
â—Ź Ruby
â—Ź Java 8 / Servlet 3.1
â—Ź Jetty 9
â—Ź PHP 5.6, 7
â—Ź Go 1.8, 1.9, 1.10
â—Ź C#/.NET
â—Ź custom
Open Capabilities
Flexible Runtime
Languages
â—Ź Python 2.7, 3.7
â—Ź Java 7, 8
â—Ź PHP 5.5, 7.2
â—Ź Go 1.6, 1.8, 1.11
â—Ź Node.js 8
"Constrained" Capabilities
Incredibly rapid scale
Bold == 2nd generation
Standard Runtime
Google Cloud Functions
Function-hosting in the cloud
7. "Hello World" Python Cloud Function
main.py
def hello_world(request):
return 'Hello World!'
$ gcloud functions deploy hello --runtime python37 --trigger-http
curl:
curl -X POST https://[GCP_REGION]-[PROJECT_ID].cloudfunctions.net/hello
-H "Content-Type:application/json" --data '{"value": "123"}'
browser:
http://[GCP_REGION]-[PROJECT_ID].cloudfunctions.net/hello?value=123
Ex: https://us-central1-myproject-ccsc.cloudfunctions.net/hello
Google Cloud Functions
Languages Supported
â—Ź Node.js 6, 8 (JavaScript)
â—Ź Python 3.7
Deploying Cloud Functions
â—Ź Create locally then deploy on cmd-line OR
â—Ź Edit and deploy from developer web console
Triggering Cloud Functions (response to events)
● HTTP — via HTTP request
● Cloud Storage — bucket object/metadata CRUD
● Cloud Pub/Sub — new message
â—Ź Firebase (DB, Storage, Analytics, Auth)
8. Test tool
Google Apps Script (and App Maker)
Customized JS runtime for G Suite automation, extension, and integration
10. 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);
MailApp.sendEmail(EMAIL, "Map", map.getMapUrl());
}
JS
11. 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 both platforms (GCP + G Suite)
12. References
â—Ź G Suite and Google Apps Script documentation
â—‹ developers.google.com/gsuite
â—‹ developers.google.com/apps-script
â—Ź GCP docs source code (i.e., App Engine & Cloud Functions quickstarts)
â—‹ github.com/GoogleCloudPlatform/python-docs-samples
â—‹ github.com/GoogleCloudPlatform/nodejs-docs-samples
â—Ź Inspirational demo apps' resources
â—‹ cloud.withgoogle.com/next18/sf/sessions/session/156878
â– cloud.google.com/blog/products/application-development/
adding-custom-intelligence-to-gmail-with-serverless-on-gcp
â– bit.ly/2OcptaG
â—‹ NEXT '19: cloud.withgoogle.com/next/sf/sessions?session=DEV212
Learning resources
â—Ź Codelabs: self-paced hands-on tutorials
â—‹ Google codelabs: need a Gmail account, always free
â– g.co/codelabs/cloud
â—‹ Qwiklabs codelabs: don't need a Gmail acct; typically not free
â– google.qwiklabs.com
â– Individuals can request 200 more credits; 5000 credits for use in courses
â—Ź Official GCP docs: cloud.google.com
â—‹ Recommended: Getting Started, Cloud Console, Cloud Shell, Cloud SDK, GCP
Free Tier (need a credit card), Community
â—Ź YouTube video series: youtube.com/GoogleCloud
â—‹ Recommended: Cloud Minute shorts & Cloud NEXT videos
â—‹ G Suite Dev Show: goo.gl/JpBQ40
13. Resources for Higher Education
â—Ź Education grant program
â—‹ Teaching grants (per-course basis)
â– $50USD for students
â– $100USD for faculty & TAs
■You'll barely use any of it… key: no need to give Google a credit card
â—‹ Research grants
â– Larger amounts, granted for longer period of time
â—‹ Turnaround time: 3-4 business days
â—Ź Teacher center
â—‹ teachercenter.withgoogle.com/gcp
â—‹ Apply here for education grants
â—‹ Apply here for Qwiklabs credits
Thank you! Questions?
Wesley Chun
@wescpy