Google cloud offers cloud computing sources for deployment of almost all kind of applications to cloud. We can deploy using App Engine, Compute Engine and Kubernetes and Docker. In this tutorial we will learn how to connect a custom domain to Google compute engine.
First you have to have a domain name for registration. There are different sources available for that such as Google Domains, Godaddy, Namecheap and different other sources. We will using google domains for this tutorial. You can use any other domain provider also. Steps are same for all. Register a domain on a domain name provider for next steps.
Next step is to create and connect a google account and create a project of select one on Google Cloud console. Also you need to enable billing for using Google Compute engine. Now, if all steps are done, we are ready to create a new virtual machine in cloud console.
Get to https://console.cloud.google.com/ and select a project. If you are just getting started, you can create a new project.
Next get to Compute Engine section. and click on VM Instances.
In next section Click on create to create a VM instance. We will be using an Ubuntu 18.04 machine with F1 Micro Instance.
In Machine type select F1 Micro Instance and Then in Boot Disk select Ubuntu > Ubuntu 18.04 with 10GB boot disk will be enough. 1 F1 Micro instance is free for usage in Google cloud, you don’t have to pay for this instance. Also allow HTTP Traffic and HTTPS if you want to use SSL. Once your machine is created, you can view your Externel IP to communicate with Machine. You will use this IP to connect to domain. You can also reserve this IP for yourself, in case you shutdown this machine.
In sidebar, now select network services and select Cloud DNS option. It will auto enable DNS api. We need to Create a record set and add DNS names to connect out domain to This external IP of your virtual machine.
Now select to create a zone. And enter details such as Zone Name and your DNS name(It will be your domain name, for example shadefinder.app. Then click to create.
Click to add a “A” record set. Type your External IP address of Virtual Machine in IPV4 Adress and click to create. It will be used to tell domain where to get where application is running.
Create another CName record. In this record, write www in DNS Name. Change Resource Record type to CNAME and in Conanical name enter your domain name.
Now, you have setup your DNS for server. Its time to add these DNS records to your domain name
It will take a little while to activate your domain with Google Compute engine. After that you are good to go to deploy your application on cloud. View next steps to check how you can deploy your applications such as NodeJS and Flask Python on Compute engine using NGINX. You can also follow Google Cloud docs for more details.