Journey to Serverless on Google Cloud Platform
Tags: serverless, appengine, cloudrun, cloudfunction
Published: 2019-12-09 11:37:30

---
title: Journey to Serverless on Google Cloud Platform
published: true
description: Google Cloud’s serverless platform lets you write code your way without worrying about the underlying infrastructure. This guide talks about deploying functions or apps as source code or as containers. 
tags: serverless, appengine, cloudrun, cloudfunction
---


Google Cloud’s serverless platform lets you write code your way without worrying about the underlying infrastructure. Deploy functions or apps as source code or as containers. Build full-stack serverless applications with Google Cloud’s storage, databases, machine learning, and more while using your favorite language, runtimes, frameworks, and libraries.

![gcp-serverless-options.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1569458451294/UO5DJ2QE5.png)

Serverless doesn’t mean there are no servers, instead, it takes the workload of managing a server which removes the needs for handling the configuring, provisioning, load balancing, sharding, scaling, and infrastructure management, so you can focus on building great applications.

![serverless-intro.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1569457562961/spgVmjhvO.png)
Serverless computing (also known as **No-Ops**) distributes majorly across operational and developer experiences, thus ensuring:
-  There are no servers to manage or provision
-  Bills are optimized to what you use
-  Focus on Code
-  Scale-up fast
-  Scale down 

![serverless-more-than-faas.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1569457975511/UBdj7Ep-7.png)
Function as a Service (FaaS) and serverless are often used interchangeably, however serverless has more to offer than FaaS.
FaaS platforms take a function from developers, build it into an app, and deploy it in the cloud. *Serverless is much more than just FaaS. *


# GCP Serverless Compute Options 

Google Cloud provides serverless compute options that can fit into your kind of application. These options span across ***Event-based applications, HTTP applications and also Containerized applications***.


## Cloud Functions

Google Cloud Functions is a lightweight compute solution for developers to create single-purpose, stand-alone functions that respond to cloud events without the need to manage a server or runtime environment.
Common Cloud Functions use cases could be Data processing, Webhooks, Lightweight APIs, Mobile backend, IoT

![cf-triggers.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1569458612124/9xgprMBri.png)
Cloud Functions allows you to trigger your code from Google Cloud Platform, Firebase, and Google Assistant, or call it directly from any web, mobile, or backend application via HTTP. 

Cloud Functions supports code written in JavaScript (Node.js), Python, and Go. There are no new languages, tools, or frameworks to learn. All you need to do is bring code — including native libraries you bring to the platform. 

Cloud Functions provides a connective layer of logic that lets you write code to connect and extend cloud services. Listen and respond to a file upload to Cloud Storage, a log change, or an incoming message on a Cloud Pub/Sub topic.

Learn more about  [Cloud Functions.](https://cloud.google.com/functions) 


## App Engine

App Engine is a fully managed, serverless platform for developing and hosting web applications at scale. You can choose from several popular languages, libraries, and frameworks to develop your apps, then let App Engine take care of provisioning servers and scaling your app instances based on demand. 

![runtimes-cf-gae.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1569458637995/Blk3a4HU6.png)
Quickly build and deploy applications using many of the popular languages like Java, PHP, Node.js, Python, C#, .Net, Ruby and Go or bring your own language runtimes and frameworks if you choose.

Application Versioning in App Engine allows you easily host different versions of your app, easily create development, test, staging, and production environments.

Traffic Splitting in App Engine enables incoming requests to different app versions, A/B test and do incremental feature rollouts.

App Engine also provides security to your applications by defining access rules with App Engine firewall and leverage managed SSL/TLS certificates by default on your custom domain at no additional cost.

Learn more about [App Engine](https://cloud.google.com/appengine/)


## Cloud Run

Cloud Run is a managed compute platform that automatically scales your stateless containers. Cloud Run is serverless: it abstracts away all infrastructure management, so you can focus on what matters most — building great applications. 

![cr-knative.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1569459607685/Fj7Bie5QZ.png)
Cloud Run is built on the Knative open-source project, enabling the portability of your workloads across platforms.
Knative offers features like scale-to-zero, autoscaling, in-cluster builds, and eventing framework for cloud-native applications on Kubernetes. 

Cloud Run (fully managed) allows you to deploy stateless containers without having to worry about the underlying infrastructure. Your workloads are automatically scaled up or down to zero depending on the traffic to your app. You only pay when your app is running, billed to the nearest 100th millisecond.

Cloud Run for Anthos (on-premises) abstracts away complex Kubernetes concepts, allowing developers to easily leverage the benefits of Kubernetes and serverless together. It provides access to custom machine types, additional networking support, and Cloud Accelerators. 

Cloud Run automatically scales up or down from zero to N depending on traffic. It also allows for custom domain mappings and provides SSL for free.

Learn more about [Cloud Run](https://cloud.google.com/run)


# DevOps and Monitoring with serverless

Google Cloud integrate other products into deploying a serverless application and also in monitoring logs.

Deployment to serverless environments such as Cloud Function and App Engine uses [Cloud Build](https://cloud.google.com/cloud-build/) in the background and monitoring logs for serverless applications also leverages on [Stackdriver](https://cloud.google.com/stackdriver/).

![DevOps with Serverless.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1569461168731/Edw0hk_Vt.png)

Cloud Build is a service that lets you easily create continuous integration and delivery (CI/CD) pipelines for your serverless applications.

Stackdriver is a monitoring service that aggregates metrics, logs, and events for your serverless applications running on Google Cloud or on-premises.

![summary.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1569461148473/bP5tMqjHW.png)


# Useful Links
-  [Google Cloud - Choosing a Serverless Option](https://cloud.google.com/serverless-options/)
-  [Cloud Function - Functions Framework](https://cloud.google.com/functions/docs/functions-framework)
-  [App Engine -  Choosing an App Engine environment](https://cloud.google.com/appengine/docs/the-appengine-environments)
-  [Ahmetb - Cloud Run FAQ](https://github.com/ahmetb/cloud-run-faq)
-  [Serve dynamic content and host microservices using Firebase Hosting](https://firebase.google.com/docs/hosting/serverless-overview)