Compute
Engine
Windows
Server
App Engine
Flex*
Kubernetes
Engine
Linux
containers
.NET on Windows .NET (Core) on Linux
Cloud
Run
Where should I run my .NET stuff?
Cloud
Functions
Kubernetes
Engine
Windows
containers
Serverless
* Not really serverless!
Slide 7
Slide 7 text
Serverless
functions
Serverless
web applications
Serverless
HTTP containers
Source code-based event
driven functions
Source code-based web
apps and API backends
HTTP containers
fully managed
HTTP containers
on GKE cluster
Cloud
Functions
App Engine
Cloud Run
Serverless options
Slide 8
Slide 8 text
Backend functions that trigger in response to an
event
Microservices
Cloud "glue"
Certain versions of Node.js, Python, Go, Java,
.NET, PHP, Ruby
Cloud Functions
Slide 9
Slide 9 text
Cloud Functions as cloud glue
Access Google
services
Cloud Storage
Cloud Pub/Sub
HTTPS
Firebase
Cloud Scheduler
Cloud Tasks
What to do when Cloud Functions
runtime is not enough?
Create your own runtime!
Slide 12
Slide 12 text
Containers
Any language
Any library
Ecosystem around
containers
.js .rb .go
.py .sh …
0 1 0
1 0 0
1 1 1
Slide 13
Slide 13 text
Containers
Flexibility
Serverless
Velocity
Slide 14
Slide 14 text
Cloud Run
Fully managed, deploy your
workloads and don’t see the
cluster.
Cloud Run on Anthos
Deploy into Anthos, run
serverless side-by-side with
your existing workloads.
Knative Everywhere
Use the same APIs and
tooling anywhere you run
Kubernetes with Knative.
Serverless containers with Knative and Cloud Run
Slide 15
Slide 15 text
HTTPS Endpoint
Public
• Website
• API endpoint
Private
• Internal services
• Async tasks
• Mobile backend
• Webhook
Slide 16
Slide 16 text
Container contract
Listen on 0.0.0.0 on port $PORT (default 8080)
HTTP server must start < 4 min (timeout → 504)
Request time < 60 min (default → 5 min)
Stateless (in-memory file system, doesn’t persist)
Computation only within request (No background activity)
Slide 17
Slide 17 text
Container resources
1 vCPU per container instance (configurable to 4 vCPU)
256 MiB of memory up to a max of 8 GiB (configurable)
80 concurrent requests per container (configurable 1-1000)
100 max containers by default (configurable 1-1000)
Access to a Metadata Server
Sandboxed by gVisor
Slide 18
Slide 18 text
Pay per use
CPU / Memory / Requests 100ms
Slide 19
Slide 19 text
Billable time
Instance
Billable Time
Request 1 Start Request 1 End
Request 2 Start Request 2 End
Instance Time
Billable
Non-billable
Scheduled services
Command Line
Interface (CLI)
User Interface
(UI)
Scheduler
API
Cloud Run
Cloud
Scheduler
Slide 24
Slide 24 text
Custom Sources
And more ...
Workflows
Orchestrated
Cloud
Functions
Cloud
Scheduler
Eventarc
Event-driven
Cloud Run
Cloud Run
for Anthos
GKE
Compute
Engine
Pub/Sub
Sources
BigQuery
Cloud Storage
Google Sources
Targets
Serverless integration
Slide 25
Slide 25 text
Asynchronously deliver events from a wide selection of
sources to many targets
Private alpha since early 2020 as Events for Cloud Run
Public GA as Eventarc in Jan 2021
Eventarc
Slide 26
Slide 26 text
Google Cloud GA
Your own apps GA
Cloud Run GA
Cloud Functions
Preview
Workflows Preview
Targets
Sources
Cloud Run for
Anthos on GKE
Preview
Eventarc
Triggers to filter events
CloudEvents format
Slide 27
Slide 27 text
New message in a Pub/Sub topic → Cloud Run
gcloud eventarc triggers create trigger-pubsub \
--destination-run-service=$SERVICE_NAME \
--destination-run-region=$REGION \
--event-filters="type=google.cloud.pubsub.topic.v1.messagePublished"
--transport-topic=projects/$PROJECT_ID/topics/$TOPIC_ID
Pub/Sub Trigger
Slide 28
Slide 28 text
Create a trigger for new object creation in Cloud Storage → Cloud Run
gcloud eventarc triggers create trigger-gcs \
--destination-run-service=$SERVICE_NAME \
--destination-run-region=$REGION
--event-filters="type=google.cloud.storage.object.v1.finalized" \
--event-filters="bucket=$BUCKET_NAME" \
--service-account=$PROJECT_NO-compute@developer.gserviceaccount.com
Cloud Storage Trigger
Slide 29
Slide 29 text
New Compute Engine VM creation → Cloud Run
gcloud eventarc triggers create trigger-auditlog \
--destination-run-service=$SERVICE_NAME \
--destination-run-region=$REGION
--event-filters="type=google.cloud.audit.log.v1.written" \
--event-filters="serviceName=compute.googleapis.com" \
--event-filters="methodName=beta.compute.instances.insert" \
--service-account=$PROJECT_NO-compute@developer.gserviceaccount.com
Audit Log Trigger
Cloud Run Service
CloudEvent SDK
HTTP request → CloudEvent in your language
cloudevents.io
Google Events Library
Type library for CloudEvent#data
Event parsing libraries
HTTP POST
to Cloud Run URL
HTTP body is a
CloudEvent with
event data
("binary" CloudEvent V1)
(optional)
(optional)
github.com/googleapis/google-cloudevents
using CloudNative.CloudEvents;
using Google.Events;
using Google.Events.Protobuf.Cloud.PubSub.V1;
public async Task Read(HttpContext context) {
var formatter = CloudEventFormatterAttribute.CreateFormatter(typeof(MessagePublishedData));
// Read CloudEvent using CloudEvents SDK
var cloudEvent = await context.Request.ToCloudEventAsync(formatter);
// Read Pub/Sub message using Google.Events library for .NET
var messagePublishedData = (MessagePublishedData)cloudEvent.Data;
// Extract the Pub/Sub message
var pubSubMessage = messagePublishedData.Message;
Slide 35
Slide 35 text
Serverless
Compute
External
API’s
Google
API’s
etc...
Workflows - orchestrate & integrate
SaaS
API’s
Private
API’s
Other
Clouds
Payment Processor
Cloud Run
Authorize & charge CC
Notifier
Cloud Run
Notify user
Shipper
Cloud Functions
Prepare & ship items
Payment Processor
Cloud Run
Authorize & charge CC
Notifier
Cloud Run
Notify user
Shipper
Cloud Functions
Prepare & ship items
WAIT
Payment Processor
Cloud Run
Authorize & charge CC
Notifier
Cloud Run
Notify user
Shipper
Cloud Functions
Prepare & ship items
shipmentDetails
userDetails
Step Sequencing Serverless Pause
Variable passing
JSON Parsing
Steps
Slide 38
Slide 38 text
Errors and retries
Payment Processor
Cloud Run
Authorize & charge CC
Notifier
Cloud Run
Notify user
Shipper
Cloud Functions
Prepare & ship items
MAX: 5 times
BACKOFF
Payment Processor
Cloud Run
Authorize & charge CC
Notifier
Cloud Run
Notify user
Shipper
Cloud Functions
Prepare & ship items
Pager
Cloud Run
Escalate to support
SUCCESS ERROR
Configurable retries Configurable exception handling
Slide 39
Slide 39 text
Conditionals and 3rd party calls
Notifier
Cloud Run
Notify user
Shipper
Cloud Functions
Prepare & ship items
Pager
Cloud Run
Escalate to support
SUCCESS
ERROR
Out of
Stock?
No
Request from the
supplier
Yes
Read inventory
Inventory DB
Update inventory
Inventory DB
Supplier API
Slide 40
Slide 40 text
Other useful features
Subworkflows
to encapsulate common reusable flows
Connectors
to connect to other Google Cloud services & APIs
More
iterations, callbacks (preview)
Slide 41
Slide 41 text
Deploy, execute, manage workflows
# Deploy a workflow
gcloud workflows deploy my-workflow --source=workflow.yaml
# Execute a workflow
gcloud workflows execute my-workflow
# See the result
gcloud workflows executions
describe
--workflow my-workflow