What is Google Cloud Run?

The best way to describe Cloud Run is to quote Google (almost verbatim)

About Google Cloud Run
  1. Cloud Run is a managed compute platform that enables you to run containers that are invocable via requests or events. Cloud Run is serverless: it abstracts away all infrastructure management, so you can focus on what matters most — building great applications.
  2. It allows you to develop and deploy highly scalable containerized applications on a fully managed serverless platform.
  3. It allows you to write code your way using your favorite language
  4. It is built upon the container and Knative open standards, enabling portability of your applications
  5. Cloud Run automatically and horizontally scales out your container image to handle the received requests, then scales in when demand decreases. You only pay for the CPU, memory, and networking consumed during request handling.
Sources: (i) About Cloud Run (ii) Automatic Scaling and Costs

In this guide, we will need to perform tasks in the Visual Studio environment as well as in the Google Cloud platform.

Setting Up Your Environment

  1. Install Visual Studio 2022 If you do not already have Visual Studio 2022 installed, you can heard over to the link below, select your preferred version and install it:
  2. Setup Google Cloud Environment
    Follow the steps below to create and setup you Google Cloud Environment.
  • Obtain a Google Cloud account. If you do not already have a Google Cloud Account, you can heard over to the link below to obtain an account, Google may still have a $300 credit to get started:
  • Install Google Cloud SDK You will need the cloud SDK to work with Cloud Run. Follow the installation instructions at the link below:
  • In this example we will be using the gcloud-cli (installed by the SDK); there's no need to install the optional App Engine components (see step 5 of the instructions for installing the SDK). Since we will be using docker to push out images to the Google Cloud platform, we will need the gcloud-cli to authorize access and perform other cloud-based functions.
    Of most interest to us are the following gcloud commands used to initialize the cli and to set it to handle authorization requests:
    • gcloud init
    • gcloud auth login
    Follow the directions at the link below to initialize gcloud and have it handle cloud authorization for Docker.
    • Run gcloud auth configure-docker. Since we'll be using docker, configure docker to use gcloud to provide credentials for Google Cloud. Instructions are provided here:
    • Make a decison on which geographical location in which to host your application and containers. A full list of regions can be found at the link below. In this example, I am using us-east1.
NOTE: The Google Cloud SDK gets a lot of updates, so it is a good idea to check the referenced url's since the instructions may have been updated.