How to assign your domain to your Google Cloud Platform using Cloudflare

by | Sep 17, 2022

🎯 What’s the goal?
Assign your domain to your GCP Hosting account.
⚠️ Why does it matter?
So your domain name redirects to the server hosting your website.
🏁 What’s the result?
Your domain name points to your GCP account.
⌚ When do you do this?
Ideally as soon you put your website online, only once.
βœ… Any special requirements?
You need to have your own domain name (SOP005) and GCP Server.
πŸ™‹β€β™‚οΈWho should do it?
Owner of the website or the person in charge of managing it.

πŸ‘‰ Where this is done: On Cloudflare.com and in Google Cloud Platform Admin Console.

⏳ How long will this take? about 15 minutes

Let’s get started, in 15-min you will be able to access your website not using its IP address but with its unique domain name.

Environment setup:

  • We recommend that you use Google Chrome browser to navigate the web.
  • Access to your Google Cloud Platform Admin Panel,
  • Access to your domain setting.

Creating Account on Cloudflare.com

  • Enter your β€œEmail” address.
  • Then come up with a β€œPassword” – it needs to fulfill the criteria underneath.
  • Finally, click on β€œCreate Account”.

After creating your Cloudflare Account go check your email. You should receive one from Cloudflare to verify your Email.

Open it and click on the provided link to finish the verification.

Connecting your domain with GCP

  • After verifying your email address go back to www.cloudflare.com.
  • Click on β€œLog In”.
  • Enter your β€œEmail” and β€œPassword” and click on β€œLog in”.
  • After you log in you should see that β€œYou currently don’t have any websites”.
  • Click on β€œ+ Add Site”.
  • Enter your site (the domain you bought – e.g. β€œsitename.com”).
  • Then click on β€œAdd site”.
  • Choose the β€œFree” plan.
  • Then click on β€œConfirm plan”.
  • Now you should see DNS records for your domain. You have to change highlighted β€œValue” to your website Public IP address. Leave this page open in your browser.

Getting your IP address from Google Cloud

  • Open another tab in your web browser.
  • Go to your Google Claud Panel. 
  • Click on the burger β€œmenu button” in the top left corner.
  • In the menu navigate to β€œCompute Engine”, then click on β€œVM instances”.
  • And there is your IP address. Copy it.
  • Go back to β€œCloudflare” and paste copied IP it in the place of highlighted value.
  • After editing it should look like this (of course with your personal β€œIPv4 Public IP”).
  • Click on β€œContinue”.

Changing your Nameservers

  • After clicking on β€œContinue” you will be presented with new β€œnameservers” for your domain. For this SOP we bought a domain on GoDaddy.com so we will show how to change your β€œnameservers” on Godaddy.com. Cloudflare will always tell you which β€œnameservers” must be replaced no matter where you bought your domain. Option to manage β€œnameservers” will always be under β€œDNS” settings. 

For the purpose of this SOP, we will operate on a domain from GoDaddy.

Check our SOP005 to find out how to buy a domain.

  • Leave Cloudflare open and in another tab of your browser go to godaddy.com.
  • Click on β€œSign In”.
  • Enter your account data and press on β€œSign In” or choose to sign in with β€œGoogle” if you used it to create an account on GoDaddy.com.
  • After you sign in you should see the domain that you bought. Click on β€œDNS” to access DNS settings.
  • Now you should see the β€œNameservers” page. Click on β€œChange”.
  • Then β€œEnter my own nameservers (advanced)”.
  • Now you should see two boxes called β€œNameserver 1” and β€œNameserver 2”. Leave this page opened.
  • Go back to Cloudflare.com and copy β€œNameserver 1”.
  • Now go back to GoDaddy.com and paste it into the β€œNameserver 1” box.
  • Now you should do the same for β€œNameserver 2”. Go back to Cloudflare and copy β€œNameserver 2”.
  • Then go back to GoDaddy.com and paste it into the β€œNameserver 2” box.
  • Click on β€œSave”.
  • After saving, refresh the GoDaddy.com page.
  • And as you can see your domain now is β€œUsing custom nameservers”.
  • After that go back to Cloudflare.com and click on β€œDone, check nameservers”.

You’re all set now and your audience can finally access your website using its own unique domain name. This is a major step in building your online brand.

How to assign your domain to your Google Cloud Platform using Cloudflare

🎯 What’s the goal?Assign your domain to your GCP Hosting account. ⚠️ Why does it matter?So your domain name redirects to the server hosting your website. 🏁 What’s the result?Your domain name points to your GCP account. ⌚ When do you do this?Ideally as soon you put your website online, only once. βœ… Any special […]
You May also Like: