GCP – ‘Cloud Run’ in Seconds

Reading Time: 4 minutes
GitHub - GoogleCloudPlatform/cloud-run-samples: Samples for Cloud Run

As a developer, you might want to quickly deliver great cloud applications like web apps, mobile APIs, and background jobs. But choosing a cloud solution often comes with trade-offs. On the one hand, you can choose to manage your servers. But this can mean provisioning and configuring them yourself, plus worrying about scaling up and down as traffic patterns change. And you might run the risk of overprovisioning resources and end up paying for more than what you need. On the other hand, you can pick a traditional serverless solution. But this can limit the languages and libraries you can use and may require code changes and make it harder to move your application. What if we had an automated solution to all of these problems?

Cloud Run – bringing server agility to your containerized apps.

Cloud Run is a fully managed compute environment for deploying and scaling serverless containerized microservices without worrying about provisioning machines, configuring clusters, or autoscaling.


Fast autoscaling – Microservices deployed in Cloud Run scale automatically based on the number of incoming requests, without you having to configure or manage a full-fledged Kubernetes cluster. Cloud Run scales to zero- that is, it uses no resources if there are no requests.

Split traffic – Cloud Run enables you to split traffic between multiple revisions, so you can perform gradual rollouts such as canary deployments or blue/green deployments.

Flexible Pricing: With Cloud Run, you pay only for the resources that your app uses, billed down to the nearest one-hundredth millisecond

Use Cases:

Web services: Websites

Build your website using a mature technology stack such as Nginx, ExpressJS, and Django, access your SQL database on Cloud SQL, and render dynamic HTML pages.

Cloud Run Example: Website

You can use Cloud Run to deploy any stateless HTTP container.

This lets you write your code in your favorite language with the framework or binary library that works for you. Then simply specify the language, your dependencies, and your start script in a Dockerfile and, with one command, package it up into a container, and you’re good to go. Your app is now deployed and running in the cloud.

You can forget about provisioning or managing servers. Cloud Run does that for you. And because Cloud Run is built with Knative, you can use it with your own Kubernetes engine cluster too. With Cloud Run on GKE, you can build and deploy apps to your own Kubernetes cluster with the same easy experience and benefits. 

Cloud Run for Anthos

Deploy your workloads running to Anthos clusters running on-premises or on Google Cloud.

 Cloud Run for Anthos provides a flexible serverless development platform for hybrid and multi-cloud environments. It is Google’s managed and fully supported Knative offering, an open-source project that enables serverless workloads on Kubernetes. Cloud Run is also available as a fully managed serverless platform on Google Cloud, without the Kubernetes platform requirements.

Getting started with Google Cloud Run

Step 1: Go to https://console.cloud.google.com/

Step 2: Click on the search bar and type “Cloud Run” and open it from the search results.

You will be greeted with a page as shown below.

Cloud Run create service

Step 3: Click on “Create Service”.

Step 4: Cloud Run service settings page will open up. Choose a name for your service here and select a region as shown below. Click “Next”.

Cloud Run Service settings

NOTE: Your configuration page might look a bit different. Under Authentication choose “Allow unauthenticated invocations” and under Ingress “Allow all traffic”. This is for demo purpose you might choose differently for your required configuration.

Step 5: Now you need to select a container image using which the service will be created. You can provide your own container image here or select from demo container images provided by Google.

configure container image

Step 6: Finally click on “Create”.

Now on the cloud run page you can see your container getting deployed and you can check it’s details and access it’s URL as shown below.

container details

How is it different from Cloud Functions?

Cloud Run and Cloud Functions are both fully managed, serverless, auto-scaling, and handle HTTP requests. They look and sound quite similar but now let’s take a look at some important differences between the two:

  • Cloud Functions lets you deploy functions written in a limited set of programming languages, while Cloud Run lets you deploy container images using any programming language. 
  • Cloud Run also supports the use of any system library from your application; Cloud Functions does not let you use custom executables. 
  • Cloud Run offers a longer request timeout duration of up to 60 minutes, as compared to a max of 9 mins allowed in Cloud Functions.
  • Cloud Functions can only send one request at a time to each function instance, while Cloud Run can send multiple concurrent requests on each container instance.


After learning about the flexibility and ease of setup of Cloud Run if you’re interested in learning more about it check out the official documentation.

For more resources on Google Cloud and more tech blogs visit Knoldus Blogs

Written by 

Agnibhas Chattopadhyay is a Software Consultant at Knoldus Inc. He is very passionate about Technology and Basketball. Experienced in languages like C, C++, Java, Python and frameworks like Spring/Springboot, Apache Kafka and CI/CD tools like Jenkins, Docker. He loves sharing knowledge by writing easy to understand tech blogs.