GCP | How to create Backend Services for Internal Load balancer

GCP Backend services provide configuration information to the load balancer. Load balancers use the information in a backend service to direct incoming traffic to one or more attached backends. The backend consists of a pool of VMs and a health check that is used to verify that the VMs are operational.

  • Login to Google Cloud Console
  • Click Activate Cloud Shell to open Cloud Shell.
  • Create a health check with following command
    gcloud compute health-checks create tcp test-health-chk \
        --port 80

  • Successful execution of command should produce output as below
    Created [https://www.googleapis.com/compute/v1/projects/*******/global/healthChecks/test-health-chk].
    NAME             PROTOCOL
    test-health-chk  TCP

  • Create backend service for Internal load balancer with following command
    1. Name of the service : test-int-lb
    2. load-balancing-scheme : internal
    3. region : us-central1
    4. health-checks : test-health-chk

    gcloud compute backend-services create test-int-lb \
        --load-balancing-scheme internal \
        --region us-central1 \
        --health-checks test-health-chk \
        --protocol tcp

  • You should see below output on successful command execution
    Created [https://www.googleapis.com/compute/v1/projects/*******/regions/us-central1/backendServices/test-int-lb].
    test-int-lb            TCP

    Category: GCP