Need help creating a "HTTP load balancer" for the Implement Load Balancing on Compute Engine: Challenge Lab

I ma trying 2 months ago to get this challenge lab without succes. I need help please:

This is my code, but it doesnt work :frowning: :

  1. Reserve a global external IP for the Load Balancer, a static IP: (THIS WORKS)

gcloud compute addresses create lb-ipv4-1
–ip-version=IPV4
–global

  1. Create the global Health Check: (THIS WORKS)

gcloud compute health-checks create http http-basic-check
–port 80

  1. CREATE FIREWALL RULES (THIS WORKS)

Step 6.1: Create the firewall rule to allow health checks:

gcloud compute firewall-rules create fw-allow-health-check
–direction=INGRESS
–priority=1000
–network=default
–action=ALLOW
–rules=tcp:80
–source-ranges=130.211.0.0/22,35.191.0.0/16 \
–target-tags=allow-health-check

  1. STEP: INSTANCE TEMPLATE AND INSTANCE GROUP

7.1: Create the instance Template (lb-backend-template) (THIS ONE DOES NOT WORK):

gcloud compute instance-templates create lb-backend-template\
–machine-type=e2-medium \
–tags=allow-health-check \
–image-family=debian-11 \
–image-project=debian-cloud \
–metadata=startup-script=‘#!/bin/bash
apt-get update
apt-get install -y apache2
hostname=$(hostname)
echo “Backend Server: $hostname” > /var/www/html/index.html’


  1. Step 2: Create the Managed Instance Group (lb-backend-group): (THIS IS NOT SERVES)

gcloud compute instance-groups managed create lb-backend-group \
–base-instance-name=lb-backend \
–size=2 \
–template=lb-backend-template\
–zone=us-east1-d

  1. Create the Backend service (THIS IS NOT WORKING)

gcloud compute backend-services create web-backend-service \
–protocol=HTTP \
–health-checks=http-basic-check \
–global

Step 9. Add the MIG (Managed Instance Group) to the Backend Service (THIS DOES NOT WORK)

gcloud compute backend-services add-backend web-backend-service \
–instance-group=lb-backend-group \
–instance-group-zone=us-east1-d \
–global

  1. Create the URL map: (THIS IS NOT WORKING)

gcloud compute url-maps create web-map-http \
–default-service=web-backend-service

  1. Create the HTTP proxy: (THIS DOES NOT WORK)

gcloud compute target-http-proxies create http-lb-proxy \
–url-map=web-map-http

  1. Create the forwarding rule: (THIS ONE DOES NOT WORK)
    gcloud compute forwarding-rules create http-content-rule \
    –global \
    –target-http-proxy=http-lb-proxy \
    –ports=80

Hi @johan_estiven_vargas,

Have you checked the error message when running the gcloud command? I tried to reproduce your code, and I’m getting ‘ERROR:unrecognized argument’. From what I can tell, it looks like you might be using en-dash(-) instead of hyphens(–) for the flags.

In the gcloud CLI, flags are additional arguments used to modify the behavior of a command or provide specific values for its parameters, like -machine-type, --tags, --image-family, --image-project, and --metadata

For further reference, refer to these documentations:

Thanks