SlideShare uma empresa Scribd logo
1 de 49
Baixar para ler offline
Powerful Google Cloud
tools for your hack
Wesley Chun
Developer Advocate, Google
Adjunct CS Faculty, Foothill College
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)
Why and Agenda
● How Google Cloud can help with your hack
● Can't hurt to learn a bit more about cloud computing
● Cloud skills are in-demand in today's workforce
● Show how to get started with Google Cloud
Cloud computing
& Google Cloud
1
Hosting your
code
2
Google APIs
primer
3
Machine
Learning
4 5
Other APIs to
consider
6
Wrap-up
01
Cloud computing
& Google Cloud
Intro and overview
What is Google Cloud Platform?
Getting things done using someone else’s computers, especially
where someone else worries about maintenance, provisioning, system
administration, security, networking, failure recovery, etc.
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, App Maker
Salesforce1/force.com
G Suite (Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
Google Compute Engine, Google Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
Outsourcing of apps (SaaS)
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google BigQuery, Cloud SQL,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Google Apps Script, App Maker
Salesforce1/force.com
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
G Suite (Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite
Google Compute Engine, Google Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
Outsourcing of hardware (IaaS)
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google BigQuery, Cloud SQL,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Google Apps Script, App Maker
Salesforce1/force.com
G Suite (Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
Google Compute Engine, Google Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
Outsourcing of logic-hosting (PaaS)
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google BigQuery, Cloud SQL,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Google Apps Script, App Maker
Salesforce1/force.com
G Suite (Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
Google Compute Engine, Google Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
IaaS/PaaS gray area (DataB/S/P-aaS?)
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google Apps Script, App Maker
Salesforce1/force.com
G Suite (Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
Google BigQuery, Cloud SQL,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Google Compute Engine, Google Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
SaaS/PaaS gray area
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google BigQuery, Cloud SQL,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
G Suite (Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
Google Apps Script, App Maker
Salesforce1/force.com
Summary of responsibility
SaaS
Software as a Service
Applications
Data
Runtime
Middleware
OS
Virtualization
Servers
Storage
Networking
Applications
Data
Runtime
Middleware
OS
Virtualization
Servers
Storage
Networking
IaaS
Infrastructure as a Service
Applications
Data
Runtime
Middleware
OS
Virtualization
Servers
Storage
Networking
PaaS
Platform as a Service
Managed by YOU Managed by cloud vendor
Applications
Data
Runtime
Middleware
OS
Virtualization
Servers
Storage
Networking
on-prem
all you, no cloud
Theme - Spec/Reqs
Logistics - Design app
Space - Provision HW
Food - Build & serve app
Manage - Manage app
on-prem
(DIY)
IaaS
(Compute Engine)
PaaS
(App Engine/GCF)
SaaS
(G Suite)
Pick theme
Plan party
Find space
Cook
On-call
Pick theme
Plan party
Rent hall
Cook
On-call
Pick theme
Plan party
Rent hall
Hire Caterer
Hire manager
Pick theme
Hire planner
Rent hall
Hire caterer
Hire manager
Imagine you’re hosting a party...
YOUR
NEXT
APP? google.com/datacenter
What is Google Cloud Platform?
GCP lets you host & run code (web apps, mobile
backends, web services, containers), store &
analyze data, and much more, all on Google’s
highly-scalable & reliable computing infrastructure
What is Google Cloud Platform?some Google Cloud Platform products
Compute Big Data
BigQuery
Cloud
Dataflow
Cloud
Dataproc
Cloud
Datalab
Cloud
Pub/Sub
Genomics
Storage & Databases
Cloud
Storage
Cloud
Bigtable
Cloud
Datastore
Cloud SQL
Cloud
Spanner
Persistent
Disk
Machine Learning
Cloud ML
Engine
Cloud
Vision API
Cloud
Speech APIs
Cloud Natural
Language API
Cloud
Translation
API
Cloud
Jobs API
Data
Studio
Cloud
Dataprep
Cloud Video
Intelligence
API
AutoML suite
Compute
Engine
App
Engine
Kubernete
s Engine
GPU
Cloud
Functions
Container-
Optimized OS
Identity & Security
Cloud IAM
Cloud Resource
Manager
Cloud Security
Scanner
Key
Management
Service
BeyondCorp
Data Loss
Prevention API
Identity-Aware
Proxy
Security Key
Enforcement
Internet of Things
Cloud IoT
Core
Transfer
Appliance
Cloud
Firestore
02
Hosting your
code
on GCP serverless/PaaS
What is Google Cloud Platform?some Google Cloud Platform products (tl;dr)
Compute Big Data
BigQuery
Cloud
Dataflow
Cloud
Dataproc
Cloud
Datalab
Cloud
Pub/Sub
Genomics
Storage & Databases
Cloud
Storage
Cloud
Bigtable
Cloud
Datastore
Cloud SQL
Cloud
Spanner
Persistent
Disk
Machine Learning
Cloud ML
Engine
Cloud
Vision API
Cloud
Speech APIs
Cloud Natural
Language API
Cloud
Translation
API
Cloud
Jobs API
Data
Studio
Cloud
Dataprep
Cloud Video
Intelligence
API
AutoML auite
Compute
Engine
App
Engine
Kubernete
s Engine
GPU
Cloud
Functions
Container-
Optimized OS
Identity & Security
Cloud IAM
Cloud Resource
Manager
Cloud Security
Scanner
Key
Management
Service
BeyondCorp
Data Loss
Prevention API
Identity-Aware
Proxy
Security Key
Enforcement
Transfer
Appliance
Cloud
Firestore
Internet of Things
Cloud IoT
Core
>
Google Compute Engine configurable
VMs of all shapes & sizes, from
"micro" to 416 vCPUs, 11.75 TB RAM,
64 TB HDD/SSD plus Google Cloud
Storage for blobs/cloud data lake
(Debian, CentOS, CoreOS, SUSE, Red Hat Enterprise Linux,
Ubuntu, FreeBSD; Windows Server 2008 R2, 2012 R2, 2016)
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
G Suite (Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
Google BigQuery, Cloud SQL,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Serverless: PaaS-y compute/processing
Google Apps Script, App Maker
Salesforce1/force.com
Running Code: App Engine
Got a great app idea? Now what?
VMs? Operating systems? Big disk?
Web servers? Load balancing?
Database servers? Autoscaling?
With Google App Engine, you don't
think about those. Just upload
your code; we do everything else.
>
cloud.google.com/appengine
Why does App Engine exist?
App Engine to the rescue!!
● Focus on app not DevOps
● Enhance productivity
● Deploy globally
● Fully-managed
● Auto-scaling
● Pay-per-use
● Familiar standard runtimes
● 2nd gen std platforms
○ Python 3.7
○ Java 8, 11
○ PHP 7.2
○ Go 1.11
○ JS/Node.js 8, 10
○ Ruby 2.5
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
Quickstart tutorial and open source repo at
cloud.google.com/appengine/docs/standard/python3/quickstart
App Engine demo
Python Flask QuickStart tutorial
(also Java, Node.js, PHP, Go, Ruby)
Running Code: Cloud Functions
Don't have an entire app? Just want
to deploy small microservices or
"RPCs" online globally? That's what
Google Cloud Functions are for!
(+Firebase version for mobile apps)
cloud.google.com/functions
firebase.google.com/products/functions
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 6, 8, 10
○ Python 3.7
○ Go 1.11, 1.12
○ Java 8
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")
Quickstart tutorial and open source repo at
cloud.google.com/functions/docs/quickstart-python
No cmd-line
access?
Use in-browser
dev environment!
● setup
● code
● deploy
● test
Cloud Functions demo
Python GCF QuickStart tutorial
(also in Node.js & Go)
Running Code: Cloud Run
Got a containerized app? Want its
flexibility along with the convenience
of serverless that's fully-managed
plus auto-scales? Google Cloud Run is
exactly what you're looking for!
cloud.google.com/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)
StateHTTP
https://yourservice.run.app
Hello World (Python "MVP")
Dockerfile
FROM python:3.7
ENV APP_HOME /app
ENV TARGET MyWorld
WORKDIR $APP_HOME
COPY . .
RUN pip install Flask gunicorn
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 app:app
cloud.google.com/run/docs/quickstarts/build-and-deploy or
github.com/knative/docs/tree/master/docs/serving/samples/h
ello-world/helloworld-python
.dockerignore
Dockerfile
README.md
*.pyc
*.pyo
*.pyd
__pycache__
Hello World (Python "MVP")
app.py
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
target = os.environ.get('TARGET', 'World')
return 'Hello {}!'.format(target)
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=int(os.environ.get('PORT', 8080)))
Hello World (Python "MVP")
Build (think docker build):
$ gcloud builds submit --tag gcr.io/PROJ_ID/CONT_NAME
Deploy (think docker push):
$ gcloud run deploy --image gcr.io/PROJ_ID/CONT_NAME
--platform managed
Access globally:
https://CONT_NAME-RANDOM_HASH-uREGION.a.run.app
03
Google APIs
primer
How to access Cloud APIs
OAuth2 or
API key
HTTP-based REST APIs 1
HTTP
2
Google APIs request-response workflow
● Application makes request
● Request received by service
● Process data, return response
● Results sent to application
(typical client-server model)
Cloud/GCP console
console.cloud.google.com
● Hub of all developer activity
● Applications == projects
○ New project for new apps
○ Projects have a billing acct
● Manage billing accounts
○ Financial instrument required
○ Personal or corporate credit cards,
Free Trial, and education grants
● Access GCP product settings
● Manage users & security
● Manage APIs in devconsole
Navigating the Cloud console
● View application statistics
● En-/disable Google APIs
● Obtain application credentials
Using Google APIs
goo.gl/RbyTFD
API manager aka Developers Console (devconsole)
console.developers.google.com
04
Machine
Learning
Access AI/ML w/API calls
quickdraw.withgoogle.com
Puppy
or
Muffin?
Machine learning is learning
from rules plus experience.
rules
data
Traditional
Programming
answers
answers
data
rulesMachine
Learning
Inference Phase
Training Phase
answers
data
rules/modelMachine
Learning
Model
predictions(new) data
Google Translate
Google Photos
Did you ever stop
to notice this app
has a search bar?!?
Full Spectrum of AI & ML Offerings
App developer Data scientist,
developer
Data scientist, Researcher
(w/infrastructure access &
DevOps/SysAdmin skills)
ML EngineAuto ML
Build custom models,
use OSS SDK on fully-
managed infrastructure
ML APIs
App developer,
data scientist
Use/customize pre-built
models
Use pre-built/pre-
trained models
Build custom models, use/
extend OSS SDK, self-manage
training infrastructure
Machine Learning: Cloud Vision
Google Cloud Vision API lets
developers extract metadata and
understand the content of an
image, identifying & detecting
objects/labels, text/OCR,
facial features, landmarks,
logos, products, XC, etc.
cloud.google.com/vision
from google.cloud import vision
IMG = 'https://google.com/services/images/section-work-card-img_2x.jpg'
client = vision.ImageAnnotatorClient()
image = vision.types.Image()
image.source.image_uri = IMG
response = client.label_detection(image=image)
print('** Labels detected (and confidence score):')
for label in response.label_annotations:
print('%s (%.2f%%)' % (label.description, label.score*100.))
response = client.face_detection(image=image)
print('n** Facial features detected (and likelihood):')
for label in response.face_annotations:
for likelihood in dir(label):
if likelihood.endswith('_likelihood'):
llh = str(vision.enums.Likelihood(getattr(label,
likelihood))).split('.')[1].replace('_', ' ').lower()
print('%s: %s' % (likelihood.split('_')[0].title(), llh))
Vision: image analysis & metadata extraction
$ python3 viz_demo.py
** Labels detected (and confidence score):
Sitting (89.94%)
Interior design (86.09%)
Furniture (82.08%)
Table (81.52%)
Room (80.85%)
White-collar worker (79.04%)
Office (76.19%)
Conversation (68.18%)
Photography (62.42%)
Window (60.96%)
** Facial features detected (and likelihood):
Anger: very unlikely
Blurred: very unlikely
Headwear: very unlikely
Joy: very likely
Sorrow: very unlikely
Surprise: very unlikely
Under: very unlikely
Vision: image analysis & metadata extraction
from google.cloud import vision
image_uri = 'gs://cloud-vision-codelab/otter_crossing.jpg'
client = vision.ImageAnnotatorClient()
image = vision.types.Image()
image.source.image_uri = image_uri
response = client.text_detection(image=image)
for text in response.text_annotations:
print('=' * 30)
print(f'"{text.description}"')
vertices = [f'({v.x},{v.y})' for v in text.bounding_poly.vertices]
print(f'bounds: {",".join(vertices)}')
Vision: OCR, text detection/extraction
$ python3 text-detect.py
==============================
"CAUTION
Otters crossing
for next 6 miles
"
bounds: (61,243),(251,243),(251,340),(61,340)
==============================
"CAUTION"
bounds: (75,245),(235,243),(235,269),(75,271)
==============================
"Otters"
bounds: (65,296),(140,297),(140,315),(65,314)
==============================
"crossing"
bounds: (151,294),(247,295),(247,317),(151,316)
:
Vision: OCR, text detection/extraction
g.co/codelabs/vision-python
Cloud Vision
exercise
g.co/codelabs/vision-
python
(others at gcplab.me)
Machine Learning: Cloud Natural Language
Google Cloud Natural Language API
reveals the structure and meaning
of text, performing sentiment
analysis, content classification,
entity extraction, and syntactical
structure analysis; multi-lingual
cloud.google.com/language
Simple sentiment & classification analysis
from google.cloud import language
TEXT = '''Google, headquartered in Mountain View, unveiled the new Android
phone at the Consumer Electronics Show. Sundar Pichai said in
his keynote that users love their new Android phones.'''
NL = language.LanguageServiceClient()
document = language.types.Document(content=TEXT,
type=language.enums.Document.Type.PLAIN_TEXT)
sentiment = NL.analyze_sentiment(document).document_sentiment
print('TEXT:', TEXT)
print('nSENTIMENT: score (%.2f), magnitude (%.2f)' % (
sentiment.score, sentiment.magnitude))
categories = NL.classify_text(document).categories
print('nCATEGORIES:')
for cat in categories:
print('* %s (%.2f)' % (cat.name[1:], cat.confidence))
Simple sentiment & classification analysis
$ python nl_sent_simple.py
TEXT: Google, headquartered in Mountain View, unveiled the new Android
phone at the Consumer Electronics Show. Sundar Pichai said in
his keynote that users love their new Android phones.
SENTIMENT: score (0.30), magnitude (0.60)
CATEGORIES:
* Internet & Telecom (0.76)
* Computers & Electronics (0.64)
* News (0.56)
Machine Learning: Cloud Speech
Google Cloud Speech APIs enable
developers to convert
speech-to-text and vice versa
cloud.google.com/speech
cloud.google.com/text-to-speech
Text-to-Speech: synthesizing audio text
# request body (with text body using 16-bit linear PCM audio encoding)
body = {
'input': {'text': text},
'voice': {
'languageCode': 'en-US',
'ssmlGender': 'FEMALE',
},
'audioConfig': {'audioEncoding': 'LINEAR16'},
}
# call Text-to-Speech API to synthesize text (write to text.wav file)
T2S = discovery.build('texttospeech', 'v1', developerKey=API_KEY)
audio = T2S.text().synthesize(body=body).execute().get('audioContent')
with open('text.wav', 'wb') as f:
f.write(base64.b64decode(audio))
Speech-to-Text: transcribing audio text
# request body (16-bit linear PCM audio content, i.e., from text.wav)
body = {
'audio': {'content': audio},
'config': {
'languageCode': 'en-US',
'encoding': 'LINEAR16',
},
}
# call Speech-to-Text API to recognize text
S2T = discovery.build('speech', 'v1', developerKey=API_KEY)
rsp = S2T.speech().recognize(
body=body).execute().get('results')[0]['alternatives'][0]
print('** %.2f%% confident of this transcript:n%r' % (
rsp['confidence']*100., rsp['transcript']))
Speech-to-Text: transcribing audio text
$ python s2t_demo.py
** 92.03% confident of this transcript:
'Google headquarters in Mountain View unveiled the new
Android phone at the Consumer Electronics Show Sundar
pichai said in his keynote that users love their new
Android phones'
Machine Learning: Cloud Video Intelligence
Google Cloud Video Intelligence
API makes videos searchable, and
discoverable, by extracting
metadata. Other features: object
tracking, shot change detection,
and text detection
cloud.google.com/video-intelligence
Video intelligence: make videos searchable
# request body (single payload, base64 binary video)
body = {
"inputContent": video,
"features": ['LABEL_DETECTION', 'SPEECH_TRANSCRIPTION'],
"videoContext": {"speechTranscriptionConfig": {"languageCode": 'en-US'}},
}
# perform video shot analysis followed by speech analysis
VINTEL = discovery.build('videointelligence', 'v1', developerKey=API_KEY)
resource = VINTEL.videos().annotate(body=body).execute().get('name')
while True:
results = VINTEL.operations().get(name=resource).execute()
if results.get('done'):
break
time.sleep(random.randrange(8)) # expo-backoff probably better
Video intelligence: make videos searchable
# display shot labels followed by speech transcription
for labels in results['response']['annotationResults']:
if 'shotLabelAnnotations' in labels:
print('n** Video shot analysis labeling')
for shot in labels['shotLabelAnnotations']:
seg = shot['segments'][0]
print(' - %s (%.2f%%)' % (
shot['entity']['description'], seg['confidence']*100.))
if 'speechTranscriptions' in labels:
print('** Speech transcription')
speech = labels['speechTranscriptions'][0]['alternatives'][0]
print(' - %r (%.2f%%)' % (
speech['transcript'], speech['confidence']*100.))
Video intelligence: make videos searchable
$ python3 vid_demo.py you-need-a-hug.mp4
** Video shot analysis labeling
- vacation (30.62%)
- fun (61.53%)
- interaction (38.93%)
- summer (57.10%)
** Speech transcription
- 'you need a hug come here' (79.27%)
Machine Learning: Cloud Translation
Access Google Translate
programmatically through this
API; translate an arbitrary
string into any supported
language using state-of-the-art
Neural Machine Translation
cloud.google.com/translate
● What is it, and how does it work?
○ Google Cloud ML APIs use pre-trained models
○ Perhaps those models less suitable for your data
○ Further customize/train our models for your data
○ Without sophisticated ML background
○ Translate, Vision, Natural Language, Video Intelligence, Tables
○ cloud.google.com/automl
● Steps
a. Prep your training data
b. Create dataset
c. Import items into dataset
d. Create/train model
e. Evaluate/validate model
f. Make predictions
Cloud AutoML
05
Other APIs to
consider
What else may be useful?
Storing Data: Cloud SQL
SQL servers in the cloud
High-performance, fully-managed
600MB to 416GB RAM; up to 64 vCPUs
Up to 10 TB storage; 40,000 IOPS
Types:
MySQL
Postgres
SQLServer (2019)
cloud.google.com/sql
Storing Data: Cloud Datastore
Cloud Datastore: a fully-
managed, highly-scalable
NoSQL database for your web
and mobile applications
cloud.google.com/datastore
Storing Data: Firebase
Firebase data is stored
as JSON & synchronized in
real-time to every
connected client; other
tools + FB == v2 mobile
development platform
firebase.google.com
Storing Data: Cloud Firestore
The best of both worlds: the
next generation of Cloud
Datastore (w/product rebrand)
plus features from the
Firebase realtime database
cloud.google.com/firestore
● Ordinary database - explicitiy query database for
new updates (but when?)
● Realtime database - automatically receive deltas
when database updated (setup client listener object)
● Highly scalable database
● Multi-regional data replication
● Strong consistency (vs. eventual consistency): read
your writes!
Cloud Firestore key features
Cloud Firestore data model
collections subcollections
Cloud Firestore straightforward querying
github.com/GoogleCloudPlatform/python-docs-samples/blob/master/firestore/cloud-client/snippets.py
Firestore: create & query for objects
from datetime import datetime
from google.cloud import firestore
def store_time(timestamp):
visits = FRSTOR.collection('visit')
visits.add({'timestamp': timestamp})
def fetch_times(limit):
visits = FRSTOR.collection('visit')
return visits.order_by(u'timestamp',
direction=firestore.Query.DESCENDING).limit(limit).stream()
FRSTOR = firestore.Client() # create Cloud Firestore client
print('** Adding another visit')
store_time(datetime.now()) # store a "visit" object
print('** Last 10 visits')
times = fetch_times(10) # fetch 10 most recent "visits"
for obj in times:
print('-', obj.to_dict()['timestamp'])
Storing and Analyzing Data: BigQuery
Google BigQuery is a fast, highly
scalable, fully-managed data
warehouse in the cloud for
analytics with built-in machine
learning (BQML); issue SQL queries
across multi-terabytes of data
cloud.google.com/bigquery
BigQuery: querying Shakespeare words
from google.cloud import bigquery
TITLE = "The most common words in all of Shakespeare's works"
QUERY = '''
SELECT LOWER(word) AS word, sum(word_count) AS count
FROM `bigquery-public-data.samples.shakespeare`
GROUP BY word ORDER BY count DESC LIMIT 10
'''
rsp = bigquery.Client().query(QUERY).result()
print('n*** Results for %r:n' % TITLE)
print('t'.join(col.name.upper() for col in rsp.schema)) # HEADERS
print('n'.join('t'.join(str(x) for x in row.values()) for row in rsp)) # DATA
Top 10 most common Shakespeare words
$ python bq_shake.py
*** Results for "The most common words in all of Shakespeare's works":
WORD COUNT
the 29801
and 27529
i 21029
to 20957
of 18514
a 15370
you 14010
my 12936
in 11722
that 11519
G Suite: Google Drive
Drive API allows developers to read,
write, control permissions/sharing,
import/export files, and more!
developers.google.com/drive
List (first 100) files/folders in Google Drive
from __future__ import print_function
from googleapiclient import discovery
from httplib2 import Http
from oauth2client import file, client, tools
SCOPES = 'https://www.googleapis.com/auth/drive.metadata.readonly'
store = file.Storage('storage.json')
creds = store.get()
if not creds or creds.invalid:
flow = client.flow_from_clientsecrets('client_secret.json', SCOPES)
creds = tools.run_flow(flow, store)
DRIVE = discovery.build('drive', 'v3', http=creds.authorize(Http()))
files = DRIVE.files().list().execute().get('files', [])
for f in files:
print(f['name'], f['mimeType'])
Listing your files
goo.gl/ZIgf8k
Download from Drive, upload to GCS
# Assume 1) FNAME == Drive filename (and it exists), 2) BUCKET ==
# GCS bucket name, and 3) DRIVE and GCS are API service endpoints
# Find 1st matching file on Google Drive, download binary & info
target = DRIVE.files().list(q="name='%s'" % FNAME,
fields='files(id,mimeType,modifiedTime)').execute().get('files')[0]
data = DRIVE.files().get_media(fileId=target['id']).execute()
print('Downloaded %r (%s, %s, size: %d)' % (FNAME,
target['mimeType'], target['modifiedTime'], len(data)))
# Setup metadata and upload blob/object to Google Cloud Storage
body = {'name': FNAME, 'uploadType': 'multipart', 'contentType': target['mimeType']}
data = http.MediaIoBaseUpload(io.BytesIO(data), mimetype=target['mimeType'])
rsp = GCS.objects().insert(bucket=BUCKET, body=body,
media_body=data, fields='bucket,name').execute()
print('Uploaded %r to GCS bucket %r' % (rsp['name'], rsp['bucket']))
Automate photo albums
OR
G Suite: Google Sheets
Sheets API gives you programmatic
access to spreadsheets; perform
(w/code) almost any action you can
do from the web interface as a user
developers.google.com/sheets
Try our Node.js customized reporting tool codelab:
g.co/codelabs/sheets
Why use the Sheets API?
data visualization
customized reports
Sheets as a data source
Migrate SQL data to a Sheet
# read SQL data then create new spreadsheet & add rows into it
FIELDS = ('ID', 'Customer Name', 'Product Code',
'Units Ordered', 'Unit Price', 'Status')
cxn = sqlite3.connect('db.sqlite')
cur = cxn.cursor()
rows = cur.execute('SELECT * FROM orders').fetchall()
cxn.close()
rows.insert(0, FIELDS)
DATA = {'properties': {'title': 'Customer orders'}}
SHEET_ID = SHEETS.spreadsheets().create(body=DATA,
fields='spreadsheetId').execute().get('spreadsheetId')
SHEETS.spreadsheets().values().update(spreadsheetId=SHEET_ID, range='A1',
body={'values': rows}, valueInputOption='RAW').execute()
Migrate SQL data
to Sheets
goo.gl/N1RPwC
Visualize big data results
function createColumnChart(spreadsheet) {
var sheet = spreadsheet.getSheets()[0];
var START_CELL = 'A2'; // skip header row
var END_CELL = 'B11';
var START_ROW = 5; // place chart in...
var START_COL = 5; // row 5, col 5 (E)
var OFFSET = 0;
var chart = sheet.newChart()
.setChartType(Charts.ChartType.COLUMN)
.addRange(sheet.getRange(START_CELL + ':' + END_CELL))
.setPosition(START_ROW, START_COL, OFFSET, OFFSET)
.build();
sheet.insertChart(chart);
return chart;
}
Other Google APIs & platforms
● G Suite (you can code Gmail, Google Drive, Calendar, 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
06
Wrap-up
Summary & resources for
hackers
● Key GCP product code samples for students: goo.gle/hackathon-toolkit
● Google Cloud codelabs (free, self-paced, hands-on tutorials): gcplab.me
● Other Google codelabs: g.co/codelabs
● GCP documentation - cloud.google.com/{docs,appengine,functions,vision,automl,
language,speech,text-to-speech,translate,video-intelligence,firestore,bigquery}
● Like GCP? Wanna use it in class or your research lab? Send your profs to
cloud.google.com/edu to apply for teaching or research credits!
● Know AWS? Compare w/GCP at cloud.google.com/docs/compare/aws
● Other references
○ Firebase docs - firebase.google.com
○ G Suite docs - developers.google.com/{gsuite,drive,docs,sheets,slides}
○ Videos - youtube.com/GoogleCloudPlatform (GCP) & goo.gl/JpBQ40 (G Suite)
○ Free trial (ignore) and Always Free (tier) - cloud.google.com/free
Resources (students)
Best use of Google
Cloud challenge
Use any Google Cloud affiliated product to
qualify; GCP, G Suite, Firebase, Maps, etc.
Eligible products @ cloud.google.com/products
Every member of the winning team gets:
● Google Home Mini
● Patagonia Backpack
● Cloud Pillow
● Acrylic Trophy
● Water Bottle
Best use of Google
Cloud challenge
Use any Google Cloud affiliated product to
qualify; GCP, G Suite, Firebase, Maps, etc.
Eligible products @
cloud.google.com/products
Every member of the runner-up team
receives:
● Google Home Mini
$50 in GCP credits
Check for an email from Major League
Hacking (MLH) to activate your coupon
for free $50USD worth of GCP credits!
(NOTE: must exceed Always Free tier to
incur billing, so you may not use much)
WARNING: avoid the GCP $300 free trial!! 💳 😓
Thank you! Qs?
Hit us up on Slack or Discord
Wesley Chun
@wescpy
Progress bars: goo.gl/69EJVw

Mais conteúdo relacionado

Mais procurados

Build with ALL of Google Cloud
Build with ALL of Google CloudBuild with ALL of Google Cloud
Build with ALL of Google Cloudwesley chun
 
Introduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google CloudIntroduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google 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
 
Scale with a smile with Google Cloud Platform At DevConTLV (June 2014)
Scale with a smile with Google Cloud Platform At DevConTLV (June 2014)Scale with a smile with Google Cloud Platform At DevConTLV (June 2014)
Scale with a smile with Google Cloud Platform At DevConTLV (June 2014)Ido Green
 
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
 
Exploring Google APIs with Python
Exploring Google APIs with PythonExploring Google APIs with Python
Exploring Google APIs with Pythonwesley chun
 
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 Enterprise Applications on Google Cloud Platform Cloud Computing Exp...
Building Enterprise Applications on Google Cloud Platform Cloud Computing Exp...Building Enterprise Applications on Google Cloud Platform Cloud Computing Exp...
Building Enterprise Applications on Google Cloud Platform Cloud Computing Exp...Chris Schalk
 
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
 
Cloud computing overview & running your code on Google Cloud (Jun 2019)
Cloud computing overview & running your code on Google Cloud (Jun 2019)Cloud computing overview & running your code on Google Cloud (Jun 2019)
Cloud computing overview & running your code on Google Cloud (Jun 2019)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
 
Top Advantages of Using Google Cloud Platform
Top Advantages of Using Google Cloud PlatformTop Advantages of Using Google Cloud Platform
Top Advantages of Using Google Cloud PlatformKinsta WordPress Hosting
 
30 Days Of Google Cloud Info Session-GDSC AU
30 Days Of Google Cloud Info Session-GDSC AU30 Days Of Google Cloud Info Session-GDSC AU
30 Days Of Google Cloud Info Session-GDSC AUAKSHATPATEL48
 
Google Cloud Platform 2014Q1 - Starter Guide
Google Cloud Platform   2014Q1 - Starter GuideGoogle Cloud Platform   2014Q1 - Starter Guide
Google Cloud Platform 2014Q1 - Starter GuideSimon Su
 
30 days of Google Cloud Introduction
30 days of Google Cloud Introduction30 days of Google Cloud Introduction
30 days of Google Cloud IntroductionDeepikaRana30
 
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
 
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...e-Legion
 
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
 
What is Google Cloud Platform - GDG DevFest 18 Depok
What is Google Cloud Platform - GDG DevFest 18 DepokWhat is Google Cloud Platform - GDG DevFest 18 Depok
What is Google Cloud Platform - GDG DevFest 18 DepokImre Nagi
 
GDG DevFest Romania - Architecting for the Google Cloud Platform
GDG DevFest Romania - Architecting for the Google Cloud PlatformGDG DevFest Romania - Architecting for the Google Cloud Platform
GDG DevFest Romania - Architecting for the Google Cloud PlatformMárton Kodok
 

Mais procurados (20)

Build with ALL of Google Cloud
Build with ALL of Google CloudBuild with ALL of Google Cloud
Build with ALL of Google Cloud
 
Introduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google CloudIntroduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google 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
 
Scale with a smile with Google Cloud Platform At DevConTLV (June 2014)
Scale with a smile with Google Cloud Platform At DevConTLV (June 2014)Scale with a smile with Google Cloud Platform At DevConTLV (June 2014)
Scale with a smile with Google Cloud Platform At DevConTLV (June 2014)
 
Easy path to machine learning (Spring 2021)
Easy path to machine learning (Spring 2021)Easy path to machine learning (Spring 2021)
Easy path to machine learning (Spring 2021)
 
Exploring Google APIs with Python
Exploring Google APIs with PythonExploring Google APIs with Python
Exploring Google APIs with Python
 
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 Enterprise Applications on Google Cloud Platform Cloud Computing Exp...
Building Enterprise Applications on Google Cloud Platform Cloud Computing Exp...Building Enterprise Applications on Google Cloud Platform Cloud Computing Exp...
Building Enterprise Applications on Google Cloud Platform Cloud Computing Exp...
 
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
 
Cloud computing overview & running your code on Google Cloud (Jun 2019)
Cloud computing overview & running your code on Google Cloud (Jun 2019)Cloud computing overview & running your code on Google Cloud (Jun 2019)
Cloud computing overview & running your code on Google Cloud (Jun 2019)
 
Build with all of Google Cloud
Build with all of Google CloudBuild with all of Google Cloud
Build with all of Google Cloud
 
Top Advantages of Using Google Cloud Platform
Top Advantages of Using Google Cloud PlatformTop Advantages of Using Google Cloud Platform
Top Advantages of Using Google Cloud Platform
 
30 Days Of Google Cloud Info Session-GDSC AU
30 Days Of Google Cloud Info Session-GDSC AU30 Days Of Google Cloud Info Session-GDSC AU
30 Days Of Google Cloud Info Session-GDSC AU
 
Google Cloud Platform 2014Q1 - Starter Guide
Google Cloud Platform   2014Q1 - Starter GuideGoogle Cloud Platform   2014Q1 - Starter Guide
Google Cloud Platform 2014Q1 - Starter Guide
 
30 days of Google Cloud Introduction
30 days of Google Cloud Introduction30 days of Google Cloud Introduction
30 days of Google Cloud Introduction
 
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
 
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
 
Easy path to machine learning (Spring 2020)
Easy path to machine learning (Spring 2020)Easy path to machine learning (Spring 2020)
Easy path to machine learning (Spring 2020)
 
What is Google Cloud Platform - GDG DevFest 18 Depok
What is Google Cloud Platform - GDG DevFest 18 DepokWhat is Google Cloud Platform - GDG DevFest 18 Depok
What is Google Cloud Platform - GDG DevFest 18 Depok
 
GDG DevFest Romania - Architecting for the Google Cloud Platform
GDG DevFest Romania - Architecting for the Google Cloud PlatformGDG DevFest Romania - Architecting for the Google Cloud Platform
GDG DevFest Romania - Architecting for the Google Cloud Platform
 

Semelhante a Powerful Google Cloud tools for your hack

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
 
Cloud computing overview & running your code on Google Cloud
Cloud computing overview & running your code on Google CloudCloud computing overview & running your code on Google Cloud
Cloud computing overview & running your code on Google Cloudwesley 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
 
Intro to cloud computing & running your code on Google Cloud
Intro to cloud computing & running your code on Google CloudIntro to cloud computing & running your code on Google Cloud
Intro to cloud computing & running your code on Google Cloudwesley chun
 
Serverless Computing with Python
Serverless Computing with PythonServerless Computing with Python
Serverless Computing with Pythonwesley chun
 
Cloud computing overview & running your code on Google Cloud
Cloud computing overview & running your code on Google CloudCloud computing overview & running your code on Google Cloud
Cloud computing overview & running your code on Google Cloudwesley 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'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
 
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
 
Bogdan botea, dmitry nefedkin no fiddle, efficient development on the googl...
Bogdan botea, dmitry nefedkin   no fiddle, efficient development on the googl...Bogdan botea, dmitry nefedkin   no fiddle, efficient development on the googl...
Bogdan botea, dmitry nefedkin no fiddle, efficient development on the googl...Codecamp Romania
 
Exploring Google APIs with Python
Exploring Google APIs with PythonExploring Google APIs with Python
Exploring Google APIs with Pythonwesley chun
 
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 Cloud @ Hackathons (2020)
Google Cloud @ Hackathons (2020)Google Cloud @ Hackathons (2020)
Google Cloud @ Hackathons (2020)wesley chun
 
Google Cloud Platform Update
Google Cloud Platform UpdateGoogle Cloud Platform Update
Google Cloud Platform UpdateIdo Green
 
Google... more than just a cloud
Google... more than just a cloudGoogle... more than just a cloud
Google... more than just a cloudwesley chun
 
Google Cloud lightning talk @MHacks
Google Cloud lightning talk @MHacksGoogle Cloud lightning talk @MHacks
Google Cloud lightning talk @MHackswesley chun
 
Accessing Google Cloud APIs
Accessing Google Cloud APIsAccessing Google Cloud APIs
Accessing Google Cloud APIswesley chun
 

Semelhante a Powerful Google Cloud tools for your hack (20)

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)
 
Cloud computing overview & running your code on Google Cloud
Cloud computing overview & running your code on Google CloudCloud computing overview & running your code on Google Cloud
Cloud computing overview & running your code on Google Cloud
 
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)
 
Intro to cloud computing & running your code on Google Cloud
Intro to cloud computing & running your code on Google CloudIntro to cloud computing & running your code on Google Cloud
Intro to cloud computing & running your code on Google Cloud
 
Serverless Computing with Python
Serverless Computing with PythonServerless Computing with Python
Serverless Computing with Python
 
Cloud computing overview & running your code on Google Cloud
Cloud computing overview & running your code on Google CloudCloud computing overview & running your code on Google Cloud
Cloud computing overview & running your code on Google Cloud
 
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'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
 
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)
 
Google Technical Webinar - Building Mashups with Google Apps and SAP, using S...
Google Technical Webinar - Building Mashups with Google Apps and SAP, using S...Google Technical Webinar - Building Mashups with Google Apps and SAP, using S...
Google Technical Webinar - Building Mashups with Google Apps and SAP, using S...
 
Bogdan botea, dmitry nefedkin no fiddle, efficient development on the googl...
Bogdan botea, dmitry nefedkin   no fiddle, efficient development on the googl...Bogdan botea, dmitry nefedkin   no fiddle, efficient development on the googl...
Bogdan botea, dmitry nefedkin no fiddle, efficient development on the googl...
 
Exploring Google APIs with Python
Exploring Google APIs with PythonExploring Google APIs with Python
Exploring Google APIs with Python
 
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 Cloud @ Hackathons (2020)
Google Cloud @ Hackathons (2020)Google Cloud @ Hackathons (2020)
Google Cloud @ Hackathons (2020)
 
Google Cloud Platform Update
Google Cloud Platform UpdateGoogle Cloud Platform Update
Google Cloud Platform Update
 
Google Developers Overview Deck 2015
Google Developers Overview Deck 2015Google Developers Overview Deck 2015
Google Developers Overview Deck 2015
 
Google... more than just a cloud
Google... more than just a cloudGoogle... more than just a cloud
Google... more than just a cloud
 
Google Cloud lightning talk @MHacks
Google Cloud lightning talk @MHacksGoogle Cloud lightning talk @MHacks
Google Cloud lightning talk @MHacks
 
Accessing Google Cloud APIs
Accessing Google Cloud APIsAccessing Google Cloud APIs
Accessing Google Cloud APIs
 
Hello Cloud
Hello CloudHello Cloud
Hello Cloud
 

Mais de wesley 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
 
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
 
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
 
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
 
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
 
Easy path to machine learning
Easy path to machine learningEasy path to machine learning
Easy path to machine learningwesley chun
 

Mais de wesley chun (6)

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)
 
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
 
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
Exploring Google APIs 102: Cloud vs. non-GCP Google APIsExploring Google APIs 102: Cloud vs. non-GCP Google APIs
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
 
Easy path to machine learning (2022)
Easy path to machine learning (2022)Easy path to machine learning (2022)
Easy path to machine learning (2022)
 
Exploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScriptExploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScript
 
Easy path to machine learning
Easy path to machine learningEasy path to machine learning
Easy path to machine learning
 

Último

Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
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
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 

Último (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
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
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 

Powerful Google Cloud tools for your hack

  • 1. Powerful Google Cloud tools for your hack Wesley Chun Developer Advocate, Google Adjunct CS Faculty, Foothill College 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. Why and Agenda ● How Google Cloud can help with your hack ● Can't hurt to learn a bit more about cloud computing ● Cloud skills are in-demand in today's workforce ● Show how to get started with Google Cloud Cloud computing & Google Cloud 1 Hosting your code 2 Google APIs primer 3 Machine Learning 4 5 Other APIs to consider 6 Wrap-up 01 Cloud computing & Google Cloud Intro and overview
  • 3. What is Google Cloud Platform? Getting things done using someone else’s computers, especially where someone else worries about maintenance, provisioning, system administration, security, networking, failure recovery, etc. 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, App Maker Salesforce1/force.com G Suite (Google Apps) Yahoo!Mail, Hotmail, Salesforce, Netsuite Google App Engine, Cloud Functions Heroku, Cloud Foundry, Engine Yard, AWS Lambda
  • 4. Google Compute Engine, Google Cloud Storage AWS EC2 & S3; Rackspace; Joyent Outsourcing of apps (SaaS) SaaS Software as a Service PaaS Platform as a Service IaaS Infrastructure as a Service Google BigQuery, Cloud SQL, Cloud Datastore, NL, Vision, Pub/Sub AWS Kinesis, RDS; Windows Azure SQL, Docker Google Apps Script, App Maker Salesforce1/force.com Google App Engine, Cloud Functions Heroku, Cloud Foundry, Engine Yard, AWS Lambda G Suite (Google Apps) Yahoo!Mail, Hotmail, Salesforce, Netsuite Google Compute Engine, Google Cloud Storage AWS EC2 & S3; Rackspace; Joyent Outsourcing of hardware (IaaS) SaaS Software as a Service PaaS Platform as a Service IaaS Infrastructure as a Service Google BigQuery, Cloud SQL, Cloud Datastore, NL, Vision, Pub/Sub AWS Kinesis, RDS; Windows Azure SQL, Docker Google Apps Script, App Maker Salesforce1/force.com G Suite (Google Apps) Yahoo!Mail, Hotmail, Salesforce, Netsuite Google App Engine, Cloud Functions Heroku, Cloud Foundry, Engine Yard, AWS Lambda
  • 5. Google Compute Engine, Google Cloud Storage AWS EC2 & S3; Rackspace; Joyent Outsourcing of logic-hosting (PaaS) SaaS Software as a Service PaaS Platform as a Service IaaS Infrastructure as a Service Google BigQuery, Cloud SQL, Cloud Datastore, NL, Vision, Pub/Sub AWS Kinesis, RDS; Windows Azure SQL, Docker Google Apps Script, App Maker Salesforce1/force.com G Suite (Google Apps) Yahoo!Mail, Hotmail, Salesforce, Netsuite Google App Engine, Cloud Functions Heroku, Cloud Foundry, Engine Yard, AWS Lambda Google Compute Engine, Google Cloud Storage AWS EC2 & S3; Rackspace; Joyent IaaS/PaaS gray area (DataB/S/P-aaS?) SaaS Software as a Service PaaS Platform as a Service IaaS Infrastructure as a Service Google Apps Script, App Maker Salesforce1/force.com G Suite (Google Apps) Yahoo!Mail, Hotmail, Salesforce, Netsuite Google App Engine, Cloud Functions Heroku, Cloud Foundry, Engine Yard, AWS Lambda Google BigQuery, Cloud SQL, Cloud Datastore, NL, Vision, Pub/Sub AWS Kinesis, RDS; Windows Azure SQL, Docker
  • 6. Google Compute Engine, Google Cloud Storage AWS EC2 & S3; Rackspace; Joyent SaaS/PaaS gray area SaaS Software as a Service PaaS Platform as a Service IaaS Infrastructure as a Service Google BigQuery, Cloud SQL, Cloud Datastore, NL, Vision, Pub/Sub AWS Kinesis, RDS; Windows Azure SQL, Docker G Suite (Google Apps) Yahoo!Mail, Hotmail, Salesforce, Netsuite Google App Engine, Cloud Functions Heroku, Cloud Foundry, Engine Yard, AWS Lambda Google Apps Script, App Maker Salesforce1/force.com Summary of responsibility SaaS Software as a Service Applications Data Runtime Middleware OS Virtualization Servers Storage Networking Applications Data Runtime Middleware OS Virtualization Servers Storage Networking IaaS Infrastructure as a Service Applications Data Runtime Middleware OS Virtualization Servers Storage Networking PaaS Platform as a Service Managed by YOU Managed by cloud vendor Applications Data Runtime Middleware OS Virtualization Servers Storage Networking on-prem all you, no cloud
  • 7. Theme - Spec/Reqs Logistics - Design app Space - Provision HW Food - Build & serve app Manage - Manage app on-prem (DIY) IaaS (Compute Engine) PaaS (App Engine/GCF) SaaS (G Suite) Pick theme Plan party Find space Cook On-call Pick theme Plan party Rent hall Cook On-call Pick theme Plan party Rent hall Hire Caterer Hire manager Pick theme Hire planner Rent hall Hire caterer Hire manager Imagine you’re hosting a party... YOUR NEXT APP? google.com/datacenter
  • 8. What is Google Cloud Platform? GCP lets you host & run code (web apps, mobile backends, web services, containers), store & analyze data, and much more, all on Google’s highly-scalable & reliable computing infrastructure
  • 9. What is Google Cloud Platform?some Google Cloud Platform products Compute Big Data BigQuery Cloud Dataflow Cloud Dataproc Cloud Datalab Cloud Pub/Sub Genomics Storage & Databases Cloud Storage Cloud Bigtable Cloud Datastore Cloud SQL Cloud Spanner Persistent Disk Machine Learning Cloud ML Engine Cloud Vision API Cloud Speech APIs Cloud Natural Language API Cloud Translation API Cloud Jobs API Data Studio Cloud Dataprep Cloud Video Intelligence API AutoML suite Compute Engine App Engine Kubernete s Engine GPU Cloud Functions Container- Optimized OS Identity & Security Cloud IAM Cloud Resource Manager Cloud Security Scanner Key Management Service BeyondCorp Data Loss Prevention API Identity-Aware Proxy Security Key Enforcement Internet of Things Cloud IoT Core Transfer Appliance Cloud Firestore 02 Hosting your code on GCP serverless/PaaS
  • 10. What is Google Cloud Platform?some Google Cloud Platform products (tl;dr) Compute Big Data BigQuery Cloud Dataflow Cloud Dataproc Cloud Datalab Cloud Pub/Sub Genomics Storage & Databases Cloud Storage Cloud Bigtable Cloud Datastore Cloud SQL Cloud Spanner Persistent Disk Machine Learning Cloud ML Engine Cloud Vision API Cloud Speech APIs Cloud Natural Language API Cloud Translation API Cloud Jobs API Data Studio Cloud Dataprep Cloud Video Intelligence API AutoML auite Compute Engine App Engine Kubernete s Engine GPU Cloud Functions Container- Optimized OS Identity & Security Cloud IAM Cloud Resource Manager Cloud Security Scanner Key Management Service BeyondCorp Data Loss Prevention API Identity-Aware Proxy Security Key Enforcement Transfer Appliance Cloud Firestore Internet of Things Cloud IoT Core > Google Compute Engine configurable VMs of all shapes & sizes, from "micro" to 416 vCPUs, 11.75 TB RAM, 64 TB HDD/SSD plus Google Cloud Storage for blobs/cloud data lake (Debian, CentOS, CoreOS, SUSE, Red Hat Enterprise Linux, Ubuntu, FreeBSD; Windows Server 2008 R2, 2012 R2, 2016) cloud.google.com/compute cloud.google.com/storage Yeah, we got VMs & big disk… but why?
  • 11. 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 G Suite (Google Apps) Yahoo!Mail, Hotmail, Salesforce, Netsuite Google App Engine, Cloud Functions Heroku, Cloud Foundry, Engine Yard, AWS Lambda Google BigQuery, Cloud SQL, Cloud Datastore, NL, Vision, Pub/Sub AWS Kinesis, RDS; Windows Azure SQL, Docker Serverless: PaaS-y compute/processing Google Apps Script, App Maker Salesforce1/force.com
  • 12. Running Code: App Engine Got a great app idea? Now what? VMs? Operating systems? Big disk? Web servers? Load balancing? Database servers? Autoscaling? With Google App Engine, you don't think about those. Just upload your code; we do everything else. > cloud.google.com/appengine Why does App Engine exist?
  • 13. 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: 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 Quickstart tutorial and open source repo at cloud.google.com/appengine/docs/standard/python3/quickstart
  • 14. App Engine demo Python Flask QuickStart tutorial (also Java, Node.js, PHP, Go, Ruby) Running Code: Cloud Functions Don't have an entire app? Just want to deploy small microservices or "RPCs" online globally? That's what Google Cloud Functions are for! (+Firebase version for mobile apps) cloud.google.com/functions firebase.google.com/products/functions
  • 15. 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 6, 8, 10 ○ Python 3.7 ○ Go 1.11, 1.12 ○ Java 8 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") Quickstart tutorial and open source repo at cloud.google.com/functions/docs/quickstart-python
  • 16. No cmd-line access? Use in-browser dev environment! ● setup ● code ● deploy ● test Cloud Functions demo Python GCF QuickStart tutorial (also in Node.js & Go)
  • 17. Running Code: Cloud Run Got a containerized app? Want its flexibility along with the convenience of serverless that's fully-managed plus auto-scales? Google Cloud Run is exactly what you're looking for! cloud.google.com/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) StateHTTP https://yourservice.run.app
  • 18. Hello World (Python "MVP") Dockerfile FROM python:3.7 ENV APP_HOME /app ENV TARGET MyWorld WORKDIR $APP_HOME COPY . . RUN pip install Flask gunicorn CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 app:app cloud.google.com/run/docs/quickstarts/build-and-deploy or github.com/knative/docs/tree/master/docs/serving/samples/h ello-world/helloworld-python .dockerignore Dockerfile README.md *.pyc *.pyo *.pyd __pycache__ Hello World (Python "MVP") app.py import os from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): target = os.environ.get('TARGET', 'World') return 'Hello {}!'.format(target) if __name__ == '__main__': app.run(debug=True, host='0.0.0.0', port=int(os.environ.get('PORT', 8080)))
  • 19. Hello World (Python "MVP") Build (think docker build): $ gcloud builds submit --tag gcr.io/PROJ_ID/CONT_NAME Deploy (think docker push): $ gcloud run deploy --image gcr.io/PROJ_ID/CONT_NAME --platform managed Access globally: https://CONT_NAME-RANDOM_HASH-uREGION.a.run.app 03 Google APIs primer How to access Cloud APIs
  • 20. OAuth2 or API key HTTP-based REST APIs 1 HTTP 2 Google APIs request-response workflow ● Application makes request ● Request received by service ● Process data, return response ● Results sent to application (typical client-server model) Cloud/GCP console console.cloud.google.com ● Hub of all developer activity ● Applications == projects ○ New project for new apps ○ Projects have a billing acct ● Manage billing accounts ○ Financial instrument required ○ Personal or corporate credit cards, Free Trial, and education grants ● Access GCP product settings ● Manage users & security ● Manage APIs in devconsole
  • 21. Navigating the Cloud console ● View application statistics ● En-/disable Google APIs ● Obtain application credentials Using Google APIs goo.gl/RbyTFD API manager aka Developers Console (devconsole) console.developers.google.com
  • 22. 04 Machine Learning Access AI/ML w/API calls quickdraw.withgoogle.com
  • 24. Machine learning is learning from rules plus experience. rules data Traditional Programming answers answers data rulesMachine Learning
  • 26. Google Photos Did you ever stop to notice this app has a search bar?!? Full Spectrum of AI & ML Offerings App developer Data scientist, developer Data scientist, Researcher (w/infrastructure access & DevOps/SysAdmin skills) ML EngineAuto ML Build custom models, use OSS SDK on fully- managed infrastructure ML APIs App developer, data scientist Use/customize pre-built models Use pre-built/pre- trained models Build custom models, use/ extend OSS SDK, self-manage training infrastructure
  • 27. Machine Learning: Cloud Vision Google Cloud Vision API lets developers extract metadata and understand the content of an image, identifying & detecting objects/labels, text/OCR, facial features, landmarks, logos, products, XC, etc. cloud.google.com/vision from google.cloud import vision IMG = 'https://google.com/services/images/section-work-card-img_2x.jpg' client = vision.ImageAnnotatorClient() image = vision.types.Image() image.source.image_uri = IMG response = client.label_detection(image=image) print('** Labels detected (and confidence score):') for label in response.label_annotations: print('%s (%.2f%%)' % (label.description, label.score*100.)) response = client.face_detection(image=image) print('n** Facial features detected (and likelihood):') for label in response.face_annotations: for likelihood in dir(label): if likelihood.endswith('_likelihood'): llh = str(vision.enums.Likelihood(getattr(label, likelihood))).split('.')[1].replace('_', ' ').lower() print('%s: %s' % (likelihood.split('_')[0].title(), llh)) Vision: image analysis & metadata extraction
  • 28. $ python3 viz_demo.py ** Labels detected (and confidence score): Sitting (89.94%) Interior design (86.09%) Furniture (82.08%) Table (81.52%) Room (80.85%) White-collar worker (79.04%) Office (76.19%) Conversation (68.18%) Photography (62.42%) Window (60.96%) ** Facial features detected (and likelihood): Anger: very unlikely Blurred: very unlikely Headwear: very unlikely Joy: very likely Sorrow: very unlikely Surprise: very unlikely Under: very unlikely Vision: image analysis & metadata extraction from google.cloud import vision image_uri = 'gs://cloud-vision-codelab/otter_crossing.jpg' client = vision.ImageAnnotatorClient() image = vision.types.Image() image.source.image_uri = image_uri response = client.text_detection(image=image) for text in response.text_annotations: print('=' * 30) print(f'"{text.description}"') vertices = [f'({v.x},{v.y})' for v in text.bounding_poly.vertices] print(f'bounds: {",".join(vertices)}') Vision: OCR, text detection/extraction
  • 29. $ python3 text-detect.py ============================== "CAUTION Otters crossing for next 6 miles " bounds: (61,243),(251,243),(251,340),(61,340) ============================== "CAUTION" bounds: (75,245),(235,243),(235,269),(75,271) ============================== "Otters" bounds: (65,296),(140,297),(140,315),(65,314) ============================== "crossing" bounds: (151,294),(247,295),(247,317),(151,316) : Vision: OCR, text detection/extraction g.co/codelabs/vision-python Cloud Vision exercise g.co/codelabs/vision- python (others at gcplab.me)
  • 30. Machine Learning: Cloud Natural Language Google Cloud Natural Language API reveals the structure and meaning of text, performing sentiment analysis, content classification, entity extraction, and syntactical structure analysis; multi-lingual cloud.google.com/language Simple sentiment & classification analysis from google.cloud import language TEXT = '''Google, headquartered in Mountain View, unveiled the new Android phone at the Consumer Electronics Show. Sundar Pichai said in his keynote that users love their new Android phones.''' NL = language.LanguageServiceClient() document = language.types.Document(content=TEXT, type=language.enums.Document.Type.PLAIN_TEXT) sentiment = NL.analyze_sentiment(document).document_sentiment print('TEXT:', TEXT) print('nSENTIMENT: score (%.2f), magnitude (%.2f)' % ( sentiment.score, sentiment.magnitude)) categories = NL.classify_text(document).categories print('nCATEGORIES:') for cat in categories: print('* %s (%.2f)' % (cat.name[1:], cat.confidence))
  • 31. Simple sentiment & classification analysis $ python nl_sent_simple.py TEXT: Google, headquartered in Mountain View, unveiled the new Android phone at the Consumer Electronics Show. Sundar Pichai said in his keynote that users love their new Android phones. SENTIMENT: score (0.30), magnitude (0.60) CATEGORIES: * Internet & Telecom (0.76) * Computers & Electronics (0.64) * News (0.56) Machine Learning: Cloud Speech Google Cloud Speech APIs enable developers to convert speech-to-text and vice versa cloud.google.com/speech cloud.google.com/text-to-speech
  • 32. Text-to-Speech: synthesizing audio text # request body (with text body using 16-bit linear PCM audio encoding) body = { 'input': {'text': text}, 'voice': { 'languageCode': 'en-US', 'ssmlGender': 'FEMALE', }, 'audioConfig': {'audioEncoding': 'LINEAR16'}, } # call Text-to-Speech API to synthesize text (write to text.wav file) T2S = discovery.build('texttospeech', 'v1', developerKey=API_KEY) audio = T2S.text().synthesize(body=body).execute().get('audioContent') with open('text.wav', 'wb') as f: f.write(base64.b64decode(audio)) Speech-to-Text: transcribing audio text # request body (16-bit linear PCM audio content, i.e., from text.wav) body = { 'audio': {'content': audio}, 'config': { 'languageCode': 'en-US', 'encoding': 'LINEAR16', }, } # call Speech-to-Text API to recognize text S2T = discovery.build('speech', 'v1', developerKey=API_KEY) rsp = S2T.speech().recognize( body=body).execute().get('results')[0]['alternatives'][0] print('** %.2f%% confident of this transcript:n%r' % ( rsp['confidence']*100., rsp['transcript']))
  • 33. Speech-to-Text: transcribing audio text $ python s2t_demo.py ** 92.03% confident of this transcript: 'Google headquarters in Mountain View unveiled the new Android phone at the Consumer Electronics Show Sundar pichai said in his keynote that users love their new Android phones' Machine Learning: Cloud Video Intelligence Google Cloud Video Intelligence API makes videos searchable, and discoverable, by extracting metadata. Other features: object tracking, shot change detection, and text detection cloud.google.com/video-intelligence
  • 34. Video intelligence: make videos searchable # request body (single payload, base64 binary video) body = { "inputContent": video, "features": ['LABEL_DETECTION', 'SPEECH_TRANSCRIPTION'], "videoContext": {"speechTranscriptionConfig": {"languageCode": 'en-US'}}, } # perform video shot analysis followed by speech analysis VINTEL = discovery.build('videointelligence', 'v1', developerKey=API_KEY) resource = VINTEL.videos().annotate(body=body).execute().get('name') while True: results = VINTEL.operations().get(name=resource).execute() if results.get('done'): break time.sleep(random.randrange(8)) # expo-backoff probably better Video intelligence: make videos searchable # display shot labels followed by speech transcription for labels in results['response']['annotationResults']: if 'shotLabelAnnotations' in labels: print('n** Video shot analysis labeling') for shot in labels['shotLabelAnnotations']: seg = shot['segments'][0] print(' - %s (%.2f%%)' % ( shot['entity']['description'], seg['confidence']*100.)) if 'speechTranscriptions' in labels: print('** Speech transcription') speech = labels['speechTranscriptions'][0]['alternatives'][0] print(' - %r (%.2f%%)' % ( speech['transcript'], speech['confidence']*100.))
  • 35. Video intelligence: make videos searchable $ python3 vid_demo.py you-need-a-hug.mp4 ** Video shot analysis labeling - vacation (30.62%) - fun (61.53%) - interaction (38.93%) - summer (57.10%) ** Speech transcription - 'you need a hug come here' (79.27%) Machine Learning: Cloud Translation Access Google Translate programmatically through this API; translate an arbitrary string into any supported language using state-of-the-art Neural Machine Translation cloud.google.com/translate
  • 36. ● What is it, and how does it work? ○ Google Cloud ML APIs use pre-trained models ○ Perhaps those models less suitable for your data ○ Further customize/train our models for your data ○ Without sophisticated ML background ○ Translate, Vision, Natural Language, Video Intelligence, Tables ○ cloud.google.com/automl ● Steps a. Prep your training data b. Create dataset c. Import items into dataset d. Create/train model e. Evaluate/validate model f. Make predictions Cloud AutoML 05 Other APIs to consider What else may be useful?
  • 37. Storing Data: Cloud SQL SQL servers in the cloud High-performance, fully-managed 600MB to 416GB RAM; up to 64 vCPUs Up to 10 TB storage; 40,000 IOPS Types: MySQL Postgres SQLServer (2019) cloud.google.com/sql Storing Data: Cloud Datastore Cloud Datastore: a fully- managed, highly-scalable NoSQL database for your web and mobile applications cloud.google.com/datastore
  • 38. Storing Data: Firebase Firebase data is stored as JSON & synchronized in real-time to every connected client; other tools + FB == v2 mobile development platform firebase.google.com Storing Data: Cloud Firestore The best of both worlds: the next generation of Cloud Datastore (w/product rebrand) plus features from the Firebase realtime database cloud.google.com/firestore
  • 39. ● Ordinary database - explicitiy query database for new updates (but when?) ● Realtime database - automatically receive deltas when database updated (setup client listener object) ● Highly scalable database ● Multi-regional data replication ● Strong consistency (vs. eventual consistency): read your writes! Cloud Firestore key features Cloud Firestore data model collections subcollections
  • 40. Cloud Firestore straightforward querying github.com/GoogleCloudPlatform/python-docs-samples/blob/master/firestore/cloud-client/snippets.py Firestore: create & query for objects from datetime import datetime from google.cloud import firestore def store_time(timestamp): visits = FRSTOR.collection('visit') visits.add({'timestamp': timestamp}) def fetch_times(limit): visits = FRSTOR.collection('visit') return visits.order_by(u'timestamp', direction=firestore.Query.DESCENDING).limit(limit).stream() FRSTOR = firestore.Client() # create Cloud Firestore client print('** Adding another visit') store_time(datetime.now()) # store a "visit" object print('** Last 10 visits') times = fetch_times(10) # fetch 10 most recent "visits" for obj in times: print('-', obj.to_dict()['timestamp'])
  • 41. Storing and Analyzing Data: BigQuery Google BigQuery is a fast, highly scalable, fully-managed data warehouse in the cloud for analytics with built-in machine learning (BQML); issue SQL queries across multi-terabytes of data cloud.google.com/bigquery BigQuery: querying Shakespeare words from google.cloud import bigquery TITLE = "The most common words in all of Shakespeare's works" QUERY = ''' SELECT LOWER(word) AS word, sum(word_count) AS count FROM `bigquery-public-data.samples.shakespeare` GROUP BY word ORDER BY count DESC LIMIT 10 ''' rsp = bigquery.Client().query(QUERY).result() print('n*** Results for %r:n' % TITLE) print('t'.join(col.name.upper() for col in rsp.schema)) # HEADERS print('n'.join('t'.join(str(x) for x in row.values()) for row in rsp)) # DATA
  • 42. Top 10 most common Shakespeare words $ python bq_shake.py *** Results for "The most common words in all of Shakespeare's works": WORD COUNT the 29801 and 27529 i 21029 to 20957 of 18514 a 15370 you 14010 my 12936 in 11722 that 11519 G Suite: Google Drive Drive API allows developers to read, write, control permissions/sharing, import/export files, and more! developers.google.com/drive
  • 43. List (first 100) files/folders in Google Drive from __future__ import print_function from googleapiclient import discovery from httplib2 import Http from oauth2client import file, client, tools SCOPES = 'https://www.googleapis.com/auth/drive.metadata.readonly' store = file.Storage('storage.json') creds = store.get() if not creds or creds.invalid: flow = client.flow_from_clientsecrets('client_secret.json', SCOPES) creds = tools.run_flow(flow, store) DRIVE = discovery.build('drive', 'v3', http=creds.authorize(Http())) files = DRIVE.files().list().execute().get('files', []) for f in files: print(f['name'], f['mimeType']) Listing your files goo.gl/ZIgf8k Download from Drive, upload to GCS # Assume 1) FNAME == Drive filename (and it exists), 2) BUCKET == # GCS bucket name, and 3) DRIVE and GCS are API service endpoints # Find 1st matching file on Google Drive, download binary & info target = DRIVE.files().list(q="name='%s'" % FNAME, fields='files(id,mimeType,modifiedTime)').execute().get('files')[0] data = DRIVE.files().get_media(fileId=target['id']).execute() print('Downloaded %r (%s, %s, size: %d)' % (FNAME, target['mimeType'], target['modifiedTime'], len(data))) # Setup metadata and upload blob/object to Google Cloud Storage body = {'name': FNAME, 'uploadType': 'multipart', 'contentType': target['mimeType']} data = http.MediaIoBaseUpload(io.BytesIO(data), mimetype=target['mimeType']) rsp = GCS.objects().insert(bucket=BUCKET, body=body, media_body=data, fields='bucket,name').execute() print('Uploaded %r to GCS bucket %r' % (rsp['name'], rsp['bucket']))
  • 44. Automate photo albums OR G Suite: Google Sheets Sheets API gives you programmatic access to spreadsheets; perform (w/code) almost any action you can do from the web interface as a user developers.google.com/sheets
  • 45. Try our Node.js customized reporting tool codelab: g.co/codelabs/sheets Why use the Sheets API? data visualization customized reports Sheets as a data source Migrate SQL data to a Sheet # read SQL data then create new spreadsheet & add rows into it FIELDS = ('ID', 'Customer Name', 'Product Code', 'Units Ordered', 'Unit Price', 'Status') cxn = sqlite3.connect('db.sqlite') cur = cxn.cursor() rows = cur.execute('SELECT * FROM orders').fetchall() cxn.close() rows.insert(0, FIELDS) DATA = {'properties': {'title': 'Customer orders'}} SHEET_ID = SHEETS.spreadsheets().create(body=DATA, fields='spreadsheetId').execute().get('spreadsheetId') SHEETS.spreadsheets().values().update(spreadsheetId=SHEET_ID, range='A1', body={'values': rows}, valueInputOption='RAW').execute() Migrate SQL data to Sheets goo.gl/N1RPwC
  • 46. Visualize big data results function createColumnChart(spreadsheet) { var sheet = spreadsheet.getSheets()[0]; var START_CELL = 'A2'; // skip header row var END_CELL = 'B11'; var START_ROW = 5; // place chart in... var START_COL = 5; // row 5, col 5 (E) var OFFSET = 0; var chart = sheet.newChart() .setChartType(Charts.ChartType.COLUMN) .addRange(sheet.getRange(START_CELL + ':' + END_CELL)) .setPosition(START_ROW, START_COL, OFFSET, OFFSET) .build(); sheet.insertChart(chart); return chart; } Other Google APIs & platforms ● G Suite (you can code Gmail, Google Drive, Calendar, 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
  • 47. 06 Wrap-up Summary & resources for hackers ● Key GCP product code samples for students: goo.gle/hackathon-toolkit ● Google Cloud codelabs (free, self-paced, hands-on tutorials): gcplab.me ● Other Google codelabs: g.co/codelabs ● GCP documentation - cloud.google.com/{docs,appengine,functions,vision,automl, language,speech,text-to-speech,translate,video-intelligence,firestore,bigquery} ● Like GCP? Wanna use it in class or your research lab? Send your profs to cloud.google.com/edu to apply for teaching or research credits! ● Know AWS? Compare w/GCP at cloud.google.com/docs/compare/aws ● Other references ○ Firebase docs - firebase.google.com ○ G Suite docs - developers.google.com/{gsuite,drive,docs,sheets,slides} ○ Videos - youtube.com/GoogleCloudPlatform (GCP) & goo.gl/JpBQ40 (G Suite) ○ Free trial (ignore) and Always Free (tier) - cloud.google.com/free Resources (students)
  • 48. Best use of Google Cloud challenge Use any Google Cloud affiliated product to qualify; GCP, G Suite, Firebase, Maps, etc. Eligible products @ cloud.google.com/products Every member of the winning team gets: ● Google Home Mini ● Patagonia Backpack ● Cloud Pillow ● Acrylic Trophy ● Water Bottle Best use of Google Cloud challenge Use any Google Cloud affiliated product to qualify; GCP, G Suite, Firebase, Maps, etc. Eligible products @ cloud.google.com/products Every member of the runner-up team receives: ● Google Home Mini
  • 49. $50 in GCP credits Check for an email from Major League Hacking (MLH) to activate your coupon for free $50USD worth of GCP credits! (NOTE: must exceed Always Free tier to incur billing, so you may not use much) WARNING: avoid the GCP $300 free trial!! 💳 😓 Thank you! Qs? Hit us up on Slack or Discord Wesley Chun @wescpy Progress bars: goo.gl/69EJVw