{"id":45344,"date":"2024-03-31T17:20:27","date_gmt":"2024-03-31T17:20:27","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=45344"},"modified":"2024-03-31T17:20:27","modified_gmt":"2024-03-31T17:20:27","slug":"google-cloud-step-by-step-guide-to-create-application-load-balancers-in-google-cloud","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/google-cloud-step-by-step-guide-to-create-application-load-balancers-in-google-cloud\/","title":{"rendered":"Google Cloud: Step by Step Guide to create Application Load Balancers in Google cloud"},"content":{"rendered":"\n<p>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<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Prepare Your GCP Environment<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Log in<\/strong> to your Google Cloud Console.<\/li>\n\n\n\n<li><strong>Select or create<\/strong> a GCP project.<\/li>\n\n\n\n<li><strong>Enable billing<\/strong> for your project.<\/li>\n\n\n\n<li><strong>Enable the Compute Engine API<\/strong> if it&#8217;s not already enabled.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Configure Your Backend Service<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Create an Instance Template<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to <strong>Compute Engine &gt; Instance templates<\/strong> in the Cloud Console.<\/li>\n\n\n\n<li>Click <strong>Create instance template<\/strong>.<\/li>\n\n\n\n<li>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.<\/li>\n\n\n\n<li>Click <strong>Create<\/strong> to save the template.<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">Create a Managed Instance Group<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Navigate to <strong>Compute Engine &gt; Instance groups<\/strong>.<\/li>\n\n\n\n<li>Click <strong>Create instance group<\/strong>.<\/li>\n\n\n\n<li>Choose a <strong>Managed instance group<\/strong> type.<\/li>\n\n\n\n<li>Select the instance template you created earlier.<\/li>\n\n\n\n<li>Specify the instance group details like name, location, and the number of instances.<\/li>\n\n\n\n<li>Click <strong>Create<\/strong>.<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">Create a Health Check<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to <strong>Compute Engine &gt; Health checks<\/strong>.<\/li>\n\n\n\n<li>Click <strong>Create a health check<\/strong>.<\/li>\n\n\n\n<li>Name your health check and select <strong>HTTP<\/strong> or <strong>HTTPS<\/strong> for the protocol. Set the port to <strong>3000<\/strong>.<\/li>\n\n\n\n<li>Configure additional settings as needed, then click <strong>Create<\/strong>.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Set Up the Load Balancer<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Create the Load Balancer<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Navigate to <strong>Network Services &gt; Load balancing<\/strong>.<\/li>\n\n\n\n<li>Click <strong>Create load balancer<\/strong>.<\/li>\n\n\n\n<li>Select <strong>Start configuration<\/strong> under the <strong>HTTP(S) Load Balancing<\/strong> card.<\/li>\n\n\n\n<li>Choose <strong>From Internet to my VMs<\/strong> and click <strong>Continue<\/strong>.<\/li>\n\n\n\n<li>Set up the backend configuration:\n<ul class=\"wp-block-list\">\n<li>Click <strong>Create a backend service<\/strong>.<\/li>\n\n\n\n<li>Select the instance group you created earlier.<\/li>\n\n\n\n<li>Choose the health check you set up.<\/li>\n\n\n\n<li>Ensure the <strong>Named Port<\/strong> is set to serve on port <strong>3000<\/strong>.<\/li>\n\n\n\n<li>Save and continue.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Configure the frontend service:\n<ul class=\"wp-block-list\">\n<li>You&#8217;ll create two frontend configurations, one for HTTP and one for HTTPS.<\/li>\n\n\n\n<li><strong>For HTTP:<\/strong>\n<ul class=\"wp-block-list\">\n<li>Click <strong>Create a frontend IP and port<\/strong>.<\/li>\n\n\n\n<li>Name your service, select <strong>HTTP<\/strong> as the protocol, and use port <strong>80<\/strong>.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>For HTTPS:<\/strong>\n<ul class=\"wp-block-list\">\n<li>You need an SSL certificate. If you don&#8217;t have one, you can create or import one under <strong>Network Services &gt; SSL certificates<\/strong> before proceeding.<\/li>\n\n\n\n<li>After securing the certificate, create another frontend configuration.<\/li>\n\n\n\n<li>Select <strong>HTTPS<\/strong> as the protocol, use port <strong>443<\/strong>, and attach your SSL certificate.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Click <strong>Create<\/strong> to finalize and deploy your load balancer.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 4: DNS Configuration (Optional)<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>For easier access, you may want to configure a DNS record to point to the IP address of your load balancer&#8217;s frontend configuration. This step makes it possible to access your VMs using a domain name instead of an IP address.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 5: Verification and Testing<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>After your load balancer is set up, test accessing your application through the IP addresses associated with the load balancer&#8217;s frontend services. You should be able to reach your application on port 3000 via both HTTP and HTTPS protocols.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[2],"tags":[],"class_list":["post-45344","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/45344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=45344"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/45344\/revisions"}],"predecessor-version":[{"id":45345,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/45344\/revisions\/45345"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=45344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=45344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=45344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}