Skip to content

About

Implement Load Balancing on Compute Engine: Challenge Lab

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

Implement-Load-Balancing-on-Compute-Engine-Step-by-Step

Implement Load Balancing on Compute Engine: Challenge Lab

#Create an instance template. Don't use the default machine type. Make sure you specify e2-medium as the machine type. #Create a managed instance group based on the template. #Create a firewall rule named as permit-tcp-rule-329 to allow traffic (80/tcp). #Create a health check. #Create a backend service and add your instance group as the backend to the backend service group with named port (http:80). #Create a URL map, and target the HTTP proxy to route the incoming requests to the default backend service. #Create a target HTTP proxy to route requests to your URL map #Create a forwarding rule.

cat << EOF > startup.sh #! /bin/bash apt-get update apt-get install -y nginx service nginx start sed -i -- 's/nginx/Google Cloud Platform - '"$HOSTNAME"'/' /var/www/html/index.nginx-debian.html EOF

gcloud compute instance-templates create web-server-template
--metadata-from-file startup-script=startup.sh
--machine-type e2-m
--region us-central1

gcloud compute instance-groups managed create web-server-group
--base-instance-name web-server
--size 2
--template web-server-template
--region us-central1

gcloud compute firewall-rules create permit-tcp-rule-794
--allow tcp:80 \

gcloud compute http-health-checks create http-basic-check

gcloud compute instance-groups managed
set-named-ports web-server-group
--named-ports http:80
--region us-central1

gcloud compute backend-services create web-server-backend
--protocol HTTP
--http-health-checks http-basic-check
--global

gcloud compute backend-services add-backend web-server-backend
--instance-group web-server-group
--instance-group-region us-central1
--global

gcloud compute url-maps create web-server-map
--default-service web-server-backend

gcloud compute target-http-proxies create http-lb-proxy
--url-map web-server-map

gcloud compute forwarding-rules create http-content-rule
--global
--target-http-proxy http-lb-proxy
--ports 80

gcloud compute forwarding-rules list

Thank you!

Seun Akintola

About

Implement Load Balancing on Compute Engine: Challenge Lab

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors