Skip to main content

Command Palette

Search for a command to run...

Getting Started With API Gateway and Cloud Functions

Here the steps explain how to deploy the applications to Gcloud API Gateway using Google cloud CLI

Updated
2 min read

Prerequisites:

  • Google Cloud Account

  • Installing Google CLI

  • Sample application to deploy to gcloud

  • Postman to test

  1. In the Google Cloud console, go to the Dashboard page and select or create a Google Cloud project.

  • Name the Project as per Naming standards and click on create.

  1. Confirm billing is enabled for your project.

    https://cloud.google.com/billing/docs/how-to/modify-project

Using Google Cloud CLI:

  1. Install Google CLI in Mac using bash.
  • command to install CLI using bash
·       curl https://sdk.cloud.google.com | bash
  1. Login to gcloud in CLI
•    gcloud auth login

  1. To set Project Id
·       gcloud config set project projectId
  • Get the project Id selecting the project and projectId can be found in the URL.

  1. To check if Service List enabled

     ·       gcloud services list
    
    • Enabling required services

API Gateway requires that you enable the following Google services:

Name

Title

apigateway.googleapis.com

API Gateway API

servicemanagement.googleapis.com

Service Management API

servicecontrol.googleapis.com

Service Control API

  • If you do not see the required services listed, enable them:
    - gcloud services enable apigateway.googleapis.com
    - gcloud services enable servicemanagement.googleapis.com
    - gcloud services enable servicecontrol.googleapis.com
  1. Sample application to deploy to gcloud.
cmd:
gcloud functions deploy java-http-function --gen2 --entry-point com.example.functions.Main --runtime=java11 –-{Region} --source={folderlocation} --trigger-http --allow-unauthenticated
Example:
gcloud functions deploy java-http-function --gen2 --entry-point com.example.functions.Main --runtime=java11 --region=us-east1 --source=/Users/Downloads/gcp-cloud-functions --trigger-http --allow-unauthenticated

  • On Completion of deployment Gcp URL will be generated to call

  1. Test the Endpoint URL with the Input as per your implementation.

  1. To trace Logs

More from this blog

RNH Integration

9 posts