0
0
GCPcloud~30 mins

High availability configuration in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
High availability configuration
📖 Scenario: You are setting up a simple web application on Google Cloud Platform (GCP). To ensure your application is always available, even if one server fails, you want to configure a high availability setup.This means your app will run on multiple virtual machines, and traffic will be balanced between them automatically.
🎯 Goal: Build a high availability configuration on GCP by creating an instance template, a managed instance group with multiple instances, and a load balancer to distribute traffic.
📋 What You'll Learn
Create an instance template named web-instance-template with a Debian image
Create a managed instance group named web-mig in the us-central1-a zone using the instance template with 2 instances
Create a HTTP load balancer forwarding rule named web-lb that balances traffic to the managed instance group
💡 Why This Matters
🌍 Real World
High availability ensures that web applications stay online even if some servers fail. This setup is common for websites and services that need to be reliable.
💼 Career
Cloud engineers and DevOps professionals often configure managed instance groups and load balancers to build scalable and fault-tolerant applications.
Progress0 / 4 steps
1
Create an instance template
Create an instance template called web-instance-template using the Debian 11 image from the debian-cloud project.
GCP
Need a hint?

Use gcloud compute instance-templates create with --image-family=debian-11 and --image-project=debian-cloud.

2
Create a managed instance group
Create a managed instance group named web-mig in zone us-central1-a using the instance template web-instance-template with 2 instances.
GCP
Need a hint?

Use gcloud compute instance-groups managed create with --size 2, --template web-instance-template, and --zone us-central1-a.

3
Create a backend service and health check
Create a health check named web-health-check and a backend service named web-backend-service that uses the health check and points to the managed instance group web-mig in zone us-central1-a.
GCP
Need a hint?

Create a health check with gcloud compute health-checks create http web-health-check --port 80. Then create a backend service with gcloud compute backend-services create web-backend-service --protocol HTTP --health-checks web-health-check --global. Finally, add the instance group as backend with gcloud compute backend-services add-backend.

4
Create a HTTP load balancer forwarding rule
Create a URL map named web-url-map, a target HTTP proxy named web-http-proxy, and a global forwarding rule named web-lb that listens on port 80 and forwards traffic to the backend service web-backend-service.
GCP
Need a hint?

Create URL map: gcloud compute url-maps create web-url-map --default-service web-backend-service --global
Create target proxy: gcloud compute target-http-proxies create web-http-proxy --url-map web-url-map --global
Create forwarding rule: gcloud compute forwarding-rules create web-lb --global --ports=80 --target-http-proxy web-http-proxy.