Follow these steps to add a custom domain name to your Google Compute Engine project. I assumed that you already have a project successfully serving on Compute Engine, and have enabled billing to your account.
Select “Cloud DNS” under the “Networking” section in the left navigation bar, as shown in following screenshot. If you are doing it for the first time, it may take few minutes for activating the service.
Once Cloud DNS is active for your project, you would find a “Create Zone” button on its page. Click on it, and provide your details as suggested, and hit the Create button.
This should create a new zone record for your project, and redirect you to the detailed information page, where you can find resource record sets (NS records and SOA record).
Next step would be updating NS records of your domain name at your domain registrar. After updating NS records with your domain registrar, you have to add one A record and one CNAME record at Google Cloud DNS. You can create these record sets by clicking on the “Add Record Set” button on the top.
Add an A record with the IPV4 address of your VM in use. You can find this IP address by navigating to Compute > Compute Engine >VM instances.
Similarly, add a CNAME record with value ‘www’ and pointing to your naked domain name (xyz.com).
Once you complete above four steps (creating new zone, updating NS records with your domain name registry, creating A record and creating CNAME record), you are done! Your domain name should start serving your compute engine project.
Note that there may be some delay due to DNS propagation, so wait for it, or use Google Public DNS resolution service on your machine. Moreover, you can add other zone record types (MX, TXT etc.) in the same way by clicking on that “Add Record Set” button.