In order to link your Google Cloud VM’s static external IP address to your custom domain you will need to edit whats known as the DNS Zones.
This will redirect anyone accessing your domain via a browser to your VM’s web server which in our case is Apache2.
To begin log into your domain registars website (names.co.uk , godaddy.co.uk) login and open the Control Panel.
Next open your DNS Settings up for the domain you are trying to link to the VM. (Note this page may look a little different but should still be called the same thing so look out for it)
Next we are going to add 2 A Name Records. DNS records are used to control the location of a resource on the Internet. As an example, an A Record is used to point a logical domain name, such as “google.com”, to the IP address of Google’s hosting server, “74.125. 224.147”. In our case we will be pointing the A Name Record at our VM’s external IP.
We are going to create 3 records. For the first one leave the Host name blank and set the type as A, for the result put the VMs static external IP address which we set in an earlier tutorial. The second and third will be identical but with Host name set as www and code respectivly. The code record will point towards the VS Code server we setup on our subdomain.