Setup HTTPS Load Balancer

Creating an Instance Template:

  1. Click on the hamburger icon on the top left corner 

  2. Select Compute Engine 

  3. Select Instance templates 

  4. Click on Create instance template.                                                                                                                                                            

  5. Enter the name of your instance template i.e. whizlabs-instance-template. Do not enter any other name, It is required for validation of the lab. 

  6. Select the N1 series from the Series dropdown.                                                                                                                                            

  7. Select machine type as n1-standard-1. Do not choose any other machine-type, doing so might get your access to labs blocked.

  8. Under this mentioned tab, Go to the Startup script

  9. Enter the bash script to get these packages installed on the startup of instance. You can get this code from the Supporting Document named Instance Auto Script.

  10. Click on create to finally create your instance template 

  11. You can now see the instance template created.

Creating an Instance Group:

  1. Select Instance groups from the menu in left sidebar 

  2. Click on create instance group.                                                                                                                                                                 

  3. Enter the name of your instance group as whizlabs-instance-group. Do not enter any other name, It is required for validation of the lab.

  4. Select single zone for practice purpose

  5. Choose region as us-central1 and zone as us-central1-a 

  6. Choose your instance template which you created in the previous steps.                                                                                              

  7. Select autoscaling mode as Autoscale

  8. Choose metric type as CPU utilization and Target as 80 which means once your CPU utilization goes above 80%, new instances should add up.

  9. Enter minimum instances as 0 and Maximum as 5.

  10. Click on create to finally create your instance group 

  11. You can now see your instance group listed.

Creating a Firewall Rule:

  1. Click on the hamburger icon on the top left corner 

  2. Select VPC network under Networking section 

  3. Click on Firewall 

  4. Click on Create firewall rule 

  5. Enter the firewall rule name as http-allow. Do not enter any other name, It is required for validation of the lab.

  6. Choose the network as default 

  7. Enter priority number as 1000

  8. Choose direction as Ingress as we are allowing all incoming HTTP traffic

  9. Choose Allow as we want to allow the incoming traffic

  10. Choose target as all Instances in the network. Same rule will apply for all the instances in the network

  11. Enter the Source IP range as 0.0.0.0/0 which means Internet

  12. Enter the port as 80 and check TCP as we are allowing HTTP traffic, HTTP port is 80

  13. Click on create to create the firewall rule

Creating an External IP address:

  1. Now, choose External IP addresses

  2. Click on Reserve static address 

  3. Enter the name as whizlabs-ip. Do not enter any other name, It is required for validation of the lab.

  4. Choose the tier as Premium because we are creating .

  5. Choose IPv4 as IP version

  6. Select type as Global. At this point we are just reserving the IP address and not attaching it to our load balancer, once we configure the load balancer, then we will attach IP.

  7. Click on Reserve to reserve your Static IP address

  8. Select Network services under the Networking tab 

  9. Click on Create load balancer.                                                                                                                                                        

  10. Choose HTTP(s) Load Balancing and click on Start configuration.                                                                                                                    

  11. Choose the Internet-facing option and single region and click on continue.                                                                                

  12. Click on Continue 

  13. Enter the name of load balancer as http-lb. Do not enter any other name, It is required for validation of the lab. 

  14. Click on the Backend configuration

  15. Choose Backend services and Click on Create a backend service

  16. Enter the name of backend service as backend-server.

  17. Keep these mentioned options as default

  18. Choose your instance group which will serve as your responding backend server.     

  19. Enter the port number as 443.

  20. Keep the other fields as default.

  21. Click on Done.    

  22. Click on create a health check 

  23. Enter the name as server-health and leave options default. Do not enter any other name, It is required for validation of the lab.  

  24. Click on Save and continue.

  25. Click on Host and path rules to set URL Path.

  26. We are choosing a Simple host and path rule as default.

  27. Click on frontend configuration

  28. Enter the name of your forwarding rule which will act as the frontend of your application from now onwards and you will attach the reserved static IP to this frontend.                                                                                                                                

  29. Choose the Protocol as HTTP.

  30. Choose network tier as Premium.                                                                                                                                             

  31. Choose the type as Global.

  32. Choose your reserved IP address. This forwarding rule will redirect you to your instances in the Instance group

  33. Choose port as 80 as we are allowing only HTTP traffic

  34. Click on Create a new certificate.

  35. Enter the name of Certificate.

  36. Choose Create Google-managed certificate. You can select Self-managed as well if you have one.

  37. Enter your domain name. 

  38. Click on Create

  39. Keeping other options default. Click on Done.

  40. Click on create to finally create your load balancer

  41. You can see your loadbalancer listed 

  42. Click on Cloud DNS

  43. Now first enable the API. 

  44. Click on Create Zone.

  45. Choose Zone type as Public.

  46. Enter any friendly name.

  47. Enter your DNS name 

  48. Click on Create. 

  49. Click on Add Record Set.

  50. Choose Record Type as A, Enter your Static IP which you created to point to your DNS and Click on Create.                               

  51. Enter DNS name as www.whizlabs.in. and Record Type as CNAME and Canonical name as whizlabs.in. , You have to add a (.) dot in the end and Click on Create.

  52. You can see the DNS Data, you need to update these Name servers in your Domain provider. It might take 48hours to update.

  53. Now go to your Load Balancer. 

  54. Check the Certificate which you create.

  55. You can see the status as Provisioning, it might take up to 60minutes to update to Active, Once active you can enter https://yourdomain, you will see the result.