Skip to main content

Enable Cloud APIs with Cloud Shell

tip

This section requires a Google Cloud account. You can create one and get $300 in free credits here. Alternatively, you can use this Google Cloud Skills Boost lab — MongoDB Atlas with Natural Language API and Cloud Run. When you start the lab, you will get access to a temporary Google Cloud account that you can use for the duration of the lab.

Cloud Shell is a command-line environment running Google Cloud. You will be using Cloud Shell to enable Cloud APIs you need for the application deployment.

info

Cloud Shell is a powerful tool that will help you greatly in your Google Cloud journey. It’s a Debian-based virtual machine, preloaded with all the tools you need for Cloud development.

Configure Cloud Shell

  1. Activate Cloud Shell by clicking on the Activate Cloud Shell icon.

    Cloud Console navigation bar highlighting the 'Activate Cloud Shell' button
  2. Find your project ID in the Cloud Console dashboard.

    New Project dialog in highlighting the Project ID text
  3. Set your project using the PROJECT_ID.

    gcloud config set project <PROJECT_ID>

Enable the Cloud Run and Cloud Build APIs

  1. From Cloud Shell, enable the Cloud Run and Cloud Build APIs

    gcloud services enable run.googleapis.com
    gcloud services enable cloudbuild.googleapis.com
  2. If prompted, authorize Cloud Shell to make API calls.

  3. You should see a success message similar to this one:

    Operation "operations/acf.cc11252d-30af-47ad-9d59-477a12847c9e" finished successfully.
  4. To see all enabled APIs, you can run:

    gcloud services list

Fetch the source code

You need the source code of the app in order to deploy it to Cloud Run. Run git clone in the Cloud Shell to fetch the public Github repository.

git clone https://github.com/mongodb-developer/Google-Cloud-MongoDB-Atlas-Workshop.git