Step by Step Guide to create Application Load Balancers in Google cloud and allow HTTP and HTTPS both port to the vm running on 3000 port
Creating an Application Load Balancer (ALB) in Google Cloud Platform (GCP) to manage traffic on both HTTP and HTTPS, routing it to VM instances that serve content on port 3000, requires a series of steps involving several GCP services. This guide includes creating an instance template and managed instance group, configuring health checks, setting up the load balancer, and ensuring proper SSL configuration for HTTPS support.
Step 1: Prepare Your GCP Environment
- Log in to your Google Cloud Console.
- Select or create a GCP project.
- Enable billing for your project.
- Enable the Compute Engine API if it’s not already enabled.
Step 2: Configure Your Backend Service
Create an Instance Template
- Go to Compute Engine > Instance templates in the Cloud Console.
- Click Create instance template.
- Set up the template with your VM configuration. Make sure the startup script or the application configuration is set to serve content on port 3000.
- Click Create to save the template.
Create a Managed Instance Group
- Navigate to Compute Engine > Instance groups.
- Click Create instance group.
- Choose a Managed instance group type.
- Select the instance template you created earlier.
- Specify the instance group details like name, location, and the number of instances.
- Click Create.
Create a Health Check
- Go to Compute Engine > Health checks.
- Click Create a health check.
- Name your health check and select HTTP or HTTPS for the protocol. Set the port to 3000.
- Configure additional settings as needed, then click Create.
Step 3: Set Up the Load Balancer
Create the Load Balancer
- Navigate to Network Services > Load balancing.
- Click Create load balancer.
- Select Start configuration under the HTTP(S) Load Balancing card.
- Choose From Internet to my VMs and click Continue.
- Set up the backend configuration:
- Click Create a backend service.
- Select the instance group you created earlier.
- Choose the health check you set up.
- Ensure the Named Port is set to serve on port 3000.
- Save and continue.
- Configure the frontend service:
- You’ll create two frontend configurations, one for HTTP and one for HTTPS.
- For HTTP:
- Click Create a frontend IP and port.
- Name your service, select HTTP as the protocol, and use port 80.
- For HTTPS:
- You need an SSL certificate. If you don’t have one, you can create or import one under Network Services > SSL certificates before proceeding.
- After securing the certificate, create another frontend configuration.
- Select HTTPS as the protocol, use port 443, and attach your SSL certificate.
- Click Create to finalize and deploy your load balancer.
Step 4: DNS Configuration (Optional)
- For easier access, you may want to configure a DNS record to point to the IP address of your load balancer’s frontend configuration. This step makes it possible to access your VMs using a domain name instead of an IP address.
Step 5: Verification and Testing
- After your load balancer is set up, test accessing your application through the IP addresses associated with the load balancer’s frontend services. You should be able to reach your application on port 3000 via both HTTP and HTTPS protocols.
Latest posts by Rajesh Kumar (see all)
- Discover the Heart of India with Mera Apna Bihar - December 20, 2024
- Experience the Pulse of Bangalore with Bangalore Orbit - December 20, 2024
- Discover the City of Lakes with Bhopal Orbit - December 20, 2024