O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

Run your code serverlessly on Google's open cloud

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Run your code serverlessly
on Google's open cloud
Wesley Chun (@wescpy)
Developer Advocate, Google
Developer Advocate, Goo...
Agenda
1
Introduction
2
Cloud computing
overview
3
Introduction to
Google Cloud
4
Serverless
platforms
5
Inspirational
Ide...
● About the power to pick up and move your app
○ Grounded in belief that cloud vendors shouldn’t get in the way of your go...
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Carregando em…3
×

Confira estes a seguir

1 de 30 Anúncio

Run your code serverlessly on Google's open cloud

Baixar para ler offline

This is a half-hour technical seminar on Google support of the open source ecosystem, a quick high-level overview/review of cloud computing in general, and then focuses on serverless compute products in Google Cloud and how the platforms are more open than ever!

This is a half-hour technical seminar on Google support of the open source ecosystem, a quick high-level overview/review of cloud computing in general, and then focuses on serverless compute products in Google Cloud and how the platforms are more open than ever!

Anúncio
Anúncio

Mais Conteúdo rRelacionado

Diapositivos para si (20)

Semelhante a Run your code serverlessly on Google's open cloud (20)

Anúncio

Mais recentes (20)

Anúncio

Run your code serverlessly on Google's open cloud

  1. 1. Run your code serverlessly on Google's open cloud Wesley Chun (@wescpy) Developer Advocate, Google Developer Advocate, Google Cloud ● Mission: enable current and future developers everywhere to be successful using Google Cloud and other Google developer tools & APIs ● Videos: host of the G Suite Dev Show on YouTube ● Blogs: developers.googleblog.com & gsuite-developers.googleblog.com ● Twitters: @wescpy, @GoogleDevs, @WorkspaceDevs G Suite Dev Show goo.gl/JpBQ40 About the speaker Previous experience / background ● Software engineer & architect for 20+ years ● One of the original Yahoo!Mail engineers ● Author of bestselling "Core Python" books (corepython.com) ● Technical trainer, teacher, instructor since 1983 (Computer Science, C, Linux, Python) ● Fellow of the Python Software Foundation ● AB (Math/CS) & CMP (Music/Piano), UC Berkeley and MSCS, UC Santa Barbara ● Adjunct Computer Science Faculty, Foothill College (Silicon Valley)
  2. 2. Agenda 1 Introduction 2 Cloud computing overview 3 Introduction to Google Cloud 4 Serverless platforms 5 Inspirational Ideas 6 Summary & wrap-up 01 Google, cloud, and open source Why we believe in open source
  3. 3. ● About the power to pick up and move your app ○ Grounded in belief that cloud vendors shouldn’t get in the way of your goals ○ Embraces idea that multiple clouds w/common DevOps approach helps achieve them ● Permits richness of thought & continuous feedback loop w/users ○ Through continuous feedback loop, open source results in better software, delivered faster ○ Google regularly open sources impactful internal projects ■ Chromium, Android, Kubernetes, TensorFlow, Go, V8, gRPC, Bazel ● Open APIs preserve everyone’s ability to build on each other’s work ○ Allow developers & users to improve software iteratively & collaboratively ○ Empower companies & individual developers to change service providers at will ○ Drive faster innovation across the industry & in any given ecosystem Why Google believes in an open cloud ● Why Google Believes in Open Cloud (Jun 2018 blog post & home page) ○ cloud.google.com/blog/products/gcp/why-google-believes-in-open-cloud ○ cloud.google.com/open-cloud ● Bringing the Best of Open Source to Google Cloud customers (Apr 2019) ○ Strategic partnerships w/leading {open source,data}-centric organizations ■ Confluent, DataStax, Elastic, InfluxData, MongoDB, Neo4j, Redis Labs ○ cloud.google.com/blog/products/open-source/bringing-the-best-of-open- source-to-google-cloud-customers ○ tcrn.ch/2Z3z1qS ● Google Cloud open source blog ○ cloud.google.com/blog/products/open-source Google Cloud open source references
  4. 4. ● Mission ○ Bringing all the value of open source to Google and all the resources of Google to open source. ● Open Source Programs Office (OSPO) home page ○ opensource.google ● OSPO open source project interactive browser ○ opensource.google/projects ● OSPO open source projects in Cloud ○ opensource.google/projects/list/cloud Google's Open Source Programs Office 02 Cloud computing review All you need to know about the cloud
  5. 5. What is cloud computing? spar Google Compute Engine, Google Cloud Storage AWS EC2 & S3; Rackspace; Joyent Cloud service levels/"pillars" SaaS Software as a Service PaaS Platform as a Service IaaS Infrastructure as a Service Google BigQuery, Cloud SQL, Cloud Datastore, NL, Vision, Pub/Sub AWS Kinesis, RDS; Windows Azure SQL, Docker Google Apps Script Salesforce1/force.com Google Workspace (was G Suite/Google Apps) Yahoo!Mail, Hotmail, Salesforce, Netsuite, Office 365 Google App Engine, Cloud Functions Heroku, Cloud Foundry, Engine Yard, AWS Lambda
  6. 6. 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 03 Introduction to Google Cloud GCP and Google Workspace (formerly G Suite & Google Apps)
  7. 7. formerly ( ) Google Compute Engine, Google Cloud Storage AWS EC2 & S3; Rackspace; Joyent SaaS Software as a Service PaaS Platform as a Service IaaS Infrastructure as a Service Google Apps Script Salesforce1/force.com Google Workspace (was G Suite/Google Apps) Yahoo!Mail, Hotmail, Salesforce, Netsuite, Office 365 Google App Engine, Cloud Functions Heroku, Cloud Foundry, Engine Yard, AWS Lambda Google BigQuery, Cloud SQL, Cloud Datastore, NL, Vision, Pub/Sub AWS Kinesis, RDS; Windows Azure SQL, Docker Google Cloud Platform vs. Google Workspace Workspace APIs GCP APIs
  8. 8. cloud.google.com/hosting-options#hosting-options GCP compute option spectrum Compute Engine Kubernetes Engine (GKE) Cloud Run on Anthos Cloud Run (fully-mgd) App Engine (Flexible) App Engine (Standard) Cloud Functions 04 Google Cloud serverless GCP: Google App Engine , Cloud Functions, Cloud Run Google Workspace (formerly G Suite): Google Apps Script
  9. 9. > Google Compute Engine configurable VMs of all shapes & sizes, from "micro" to 416 vCPUs, 11.776 TB RAM, 256 TB HDD/SSD plus Google Cloud Storage for data lake "blobs" (Debian, CentOS, CoreOS, SUSE, Red Hat Enterprise Linux, Ubuntu, FreeBSD; Windows Server 2008 R2, 2012 R2, 2016, 1803, 1809, 1903/2019, 1909) cloud.google.com/compute cloud.google.com/storage Yeah, we got VMs & big disk… but why*? Serverless: what & why ● What is serverless? ○ Misnomer ○ "No worries" ○ Developers focus on writing code & solving business problems* ● Why serverless? ○ Fastest growing segment of cloud... per analyst research*: ■ $1.9B (2016) and $4.25B (2018) ⇒ $7.7B (2021) and $14.93B (2023) ○ What if you go viral? Autoscaling: your new best friend ○ What if you don't? Code not running? You're not paying. * in USD; source:Forbes (May 2018), MarketsandMarkets™ & CB Insights (Aug 2018)
  10. 10. Google Compute Engine, Google Cloud Storage AWS EC2 & S3; Rackspace; Joyent SaaS Software as a Service PaaS Platform as a Service IaaS Infrastructure as a Service Google Workspace (was G Suite/Google Apps) Yahoo!Mail, Hotmail, Salesforce, Netsuite, Office 365 Google App Engine, Cloud Functions Heroku, Cloud Foundry, Engine Yard, AWS Lambda Google BigQuery, Cloud SQL, Cloud Datastore, NL, Vision, Pub/Sub AWS Kinesis, RDS; Windows Azure SQL, Docker Serverless: PaaS-y compute/processing Google Apps Script Salesforce1/force.com Google App Engine App-hosting in the cloud
  11. 11. Why does App Engine exist? ● Focus on app not DevOps ○ Web app ○ Mobile backend ○ Cloud service ● Enhance productivity ● Deploy globally ● Fully-managed ● Auto-scaling ● Pay-per-use ● Familiar languages Hello World (Python "MVP") app.yaml runtime: python37 main.py from flask import Flask app = Flask(__name__) @app.route('/') def hello(): return 'Hello World!' requirements.txt Flask>=1.0.2 Deploy: $ gcloud app deploy Access globally: PROJECT_ID.appspot.com cloud.google.com/appengine/docs/standard/python3/quickstart
  12. 12. Popular App Engine Use Cases ● Mobile/Tablet ○ App backends ○ Cloud persistence ● Social/Mobile Games ○ Speed, scale ○ API integrations ○ Personals/dating ● Consumer Web Apps ○ Unpredictable traffic ○ Scale (up or down) ● Apps in Academia ○ Any course where students build web or mobile apps ○ Research projects ○ IT/Operational apps ● Business Apps ○ Enterprise ○ Java runtime ○ IT/Operational apps ○ Web or Mobile Google Cloud Functions Function-hosting in the cloud
  13. 13. Why does Cloud Functions exist? ● Don't have entire app? ○ No framework "overhead" (LAMP, MEAN...) ○ Deploy microservices ● Event-driven ○ Triggered via HTTP or background events ■ Pub/Sub, Cloud Storage, Firebase, etc. ○ Auto-scaling & highly-available; pay per use ● Flexible development environment ○ Cmd-line or developer console (in-browser) ● Cloud Functions for Firebase ○ Mobile app use-cases ● Available runtimes ○ JS/Node.js 8, 10, 12 ○ Python 3.7, 3.8 ○ Go 1.11, 1.13 ○ Java 11 main.py def hello_world(request): return 'Hello World!' Deploy: $ gcloud functions deploy hello --runtime python37 --trigger-http Access globally (curl): curl -X POST https://GCP_REGION-PROJECT_ID.cloudfunctions.net/hello -H "Content-Type:application/json" Access globally (browser): GCP_REGION-PROJECT_ID.cloudfunctions.net/hello Hello World (Python "MVP") cloud.google.com/functions/docs/quickstart-python
  14. 14. Google Cloud Run Container-hosting in the cloud The rise of containers... ● Any language ● Any library ● Any binary ● Ecosystem of base images ● Industry standard FLEXIBILITY
  15. 15. “We can’t be locked in.” “How can we use existing binaries?” “Why do I have to choose between containers and serverless?” “Can you support language _______ ?” Serverless inaccessible for some... CONVENIENCE Cloud Run: code, build, deploy .js .rb .go .sh.py ... ● Any language, library, binary ○ HTTP port, stateless ● Bundle into container ○ Build w/Docker OR ○ Google Cloud Build ○ Image ⇒ Container Registry ● Deploy to Cloud Run (managed or GKE) StateHTTP CONT_NAME-RANDOM_HASH- uREGION.a.run.app
  16. 16. Hello World (Python "MVP") main.py import os from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): target = os.environ.get('TARGET', 'World') return 'Hello {}!'.format(target) if __name__ == '__main__': app.run(debug=True, host='0.0.0.0', port=int(os.environ.get('PORT', 8080))) cloud.google.com/run/docs/quickstarts/build-and-deploy Hello World (Python "MVP") Dockerfile FROM python:3-slim WORKDIR /app COPY . . RUN pip install -r requirements.txt CMD ["python", "main.py"] .dockerignore Dockerfile README.md *.pyc *.pyo .git/ __pycache__ Build (think docker build and docker push): $ gcloud builds submit --tag gcr.io/PROJ_ID/CONT_NAME Deploy (think docker run): $ gcloud run deploy --image gcr.io/PROJ_ID/CONT_NAME --platform managed Access globally: CONT_NAME-RANDOM_HASH-uREGION.a.run.app requirements.txt Flask>=1.0.2
  17. 17. ● Build containers easily & securely without creating/managing Dockerfiles ● Open source, open standard; based on CNCF Buildpacks spec v3 ● Supports most common development tools ○ Go 1.10+ ○ Node.js 10+ ○ Python 3.7+ ○ Java 8 & 11 ○ .NET Core 3.1 + ● Blog post ○ cloud.google.com/blog/products/containers-kubernetes/google-cloud- now-supports-buildpacks Google Cloud buildpacks $ ls index.js package.json $ gcloud alpha builds submit --pack image=gcr.io/my-project/my-nodejs-app $ gcloud run deploy --image gcr.io/my-project/my-nodejs-app github.com/GoogleCloudPlatform/buildpacks Google Apps Script Customized serverless JS runtime for automation, and extension and integration with Google Workspace (formerly G Suite) and other Google & external services
  18. 18. “Hello World!” in Apps Script Sheets-bound “Hello World!” Apps Script intro goo.gl/1sXeuD
  19. 19. What can you do with this? Accessing maps from spreadsheets?!? goo.gl/oAzBN9 This… with help from Google Maps & Gmail function sendMap() { var sheet = SpreadsheetApp.getActiveSheet(); var address = sheet.getRange("A2").getValue(); var map = Maps.newStaticMap().addMarker(address); GmailApp.sendEmail('friend@example.com', 'Map', 'See below.', {attachments:[map]}); } JS g.co/codelabs/apps-script-intro
  20. 20. 05 Inspirational Ideas Build with ALL of Google Cloud
  21. 21. Custom intelligence in Gmail Analyze Google Workspace (formerly G Suite) data with GCP
  22. 22. Gmail message processing with GCP Gmail Cloud Pub/Sub Cloud Functions Cloud Vision Workspace (formerly G Suite) GCP Star message Message notification Trigger function Extract images Categorize images Inbox augmented with Cloud Function
  23. 23. ● Gmail API: sets up notification forwarding to Cloud Pub/Sub ● developers.google.com/gmail/api/guides/push ● Pub/Sub: triggers logic hosted by Cloud Functions ● cloud.google.com/functions/docs/calling/pubsub ● Cloud Functions: "orchestrator" accessing GCP (and Google Workspace/G Suite) APIs ● Combine all of the above to add custom intelligence to Gmail ● Deep dive code blog post ● cloud.google.com/blog/products/application-development/ adding-custom-intelligence-to-gmail-with-serverless-on-gcp ● Application source code ● github.com/GoogleCloudPlatform/cloud-functions-gmail-nodejs App summary Big data analysis to slide presentation Access GCP tools from Google Workspace (formerly G Suite)
  24. 24. Store big data results
  25. 25. Visualize big data results Ingest data from Sheets
  26. 26. Link to chart in Sheets
  27. 27. Supercharge Workspace (G Suite) with GCP Workspace (G Suite) GCP BigQuery Apps Script Slides Sheets Application request Big data analytics App summary ● Leverage GCP and build the "final mile" with Google Workspace (formerly G Suite) ● Driven by Google Apps Script ● Google BigQuery for data analysis ● Google Sheets for visualization ● Google Slides for presentable results ● "Glued" together w/Google Workspace (formerly G Suite) serverless ● Build this app (codelab): g.co/codelabs/bigquery-sheets-slides ● Video and blog post: bit.ly/2OcptaG ● Application source code: github.com/googlecodelabs/bigquery-sheets-slides ● Presented at Google Cloud NEXT (Jul 2018 [DEV229] & Apr 2019 [DEV212]) ● cloud.withgoogle.com/next18/sf/sessions/session/156878 ● cloud.withgoogle.com/next/sf/sessions?session=DEV212
  28. 28. 06 Online resources & summary References to follow-up Cost of Google Cloud serverless tools ● What is free in Google Cloud overall? ○ Free Trial (credit card required; expires) ■ $300USD credit good for first 90 days ○ Always Free tier (credit card required; no expiration; subject to change) ■ Independent of Free Trial & education grants (more below) ■ Some GCP products free up to usage limits ○ cloud.google.com/free ● Serverless Always Free tier (monthly) ○ App Engine (28 hours/day) ○ Cloud Functions & Cloud Run (2M calls/month) ● Higher education (teaching & research) grants ○ cloud.google.com/edu (credit card NOT required; expires) ○ Provides "free" usage for coursework and initial research $$ FREE $$
  29. 29. Cloud computing session summary ● Why go cloud? ○ Cloud computing has taken the world by storm ○ You're behind if you're not already using it… it's not too late! ○ Help train the next generation cloud-ready workforce! ● Google Cloud and why serverless? ○ Many features: compute, storage, AI/ML, NW, data processing, etc. ○ Serverless lets users focus on just their logic (apps or functions) ○ Interesting possibilities using all of Google Cloud (GCP + Workspace) Other Google APIs & platforms ● Google Workspace (G Suite) (code Gmail, Drive, Docs, Sheets, Slides!) ○ developers.google.com/gsuite ● Firebase (mobile development platform + RT DB) ○ firebase.google.com ● Google Data Studio (data visualization, dashboards, etc.) ○ datastudio.google.com/overview ● Actions on Google/Assistant/DialogFlow (voice apps) ○ developers.google.com/actions ● YouTube (Data, Analytics, and Livestreaming APIs) ○ developers.google.com/youtube ● Google Maps (Maps, Routes, and Places APIs) ○ developers.google.com/maps ● Flutter (native apps [Android, iOS, web] w/1 code base[!]) ○ flutter.dev
  30. 30. ● Documentation ○ GCP: cloud.google.com/{docs,appengine,functions,run,vision,automl,translate,language, speech,texttospeech,video-intelligence,firestore,bigquery,compute,storage,gpu,tpu} ○ G Suite: developers.google.com/{gsuite,drive,calendar,gmail,docs,sheets,slides,apps-script} ● Introductory "codelabs" (free, online, self-paced, hands-on tutorials [Python]) ○ App Engine: codelabs.developers.google.com/codelabs/cloud-app-engine-python ○ Cloud Functions: codelabs.developers.google.com/codelabs/cloud-starting-cloudfunctions ○ Cloud Run: codelabs.developers.google.com/codelabs/cloud-run-hello-python3 ● Other codelabs: gcplab.me (GCP) and codelabs.developers.google.com/?cat=G+Suite (G Suite) ● Videos: youtube.com/GoogleCloudPlatform (GCP) and goo.gl/JpBQ40 (G Suite) ● Code samples: github.com/GoogleCloudPlatform (GCP) and github.com/gsuitedevs (G Suite) ● Know AWS/Azure? Compare w/GCP at cloud.google.com/docs/compare/{aws,azure} ● Google Cloud serverless products: cloud.google.com/serverless ● Python on Google Cloud: cloud.google.com/python Google Cloud references Thank you! Questions? Wesley Chun @wescpy

×