How to host your WordPress site for free with Google Cloud + $300 credit

Table of Contents

When it comes to cloud computing, Amazon Web Services is by far the biggest player, which is no surprise considering they were the ones who introduced the world to the concept of cloud computing.

Personally, I prefer the user interface of Google Cloud Platform, it’s much sexier and sleekier, and integrates nicely with their other services. In all honesty, they both have their strengths and weakness, but I’m not getting into that debate in this article.

I have chosen to use GCP for this tutorial, because, in addition to their “Always Free” tier, they offer a sweet $300 “exploration” credit for 3 months. This means you get to play around with the platform without worrying about costs.

This step-by-step tutorial is designed to equip you with the following skills.

  • How to create a GSuite account and connect it to your domain so that you can have a professional .com email.
  • How to create a Google Cloud Platform account and your first project.
  • How to deploy your WordPress site on a virtual machine — aka “the Cloud”
  • How to connect your domain with your WordPress deployment.
  • How to use the terminal to SSH into your virtual machine and issue an SSL certificate for your WordPress site.

Enough talking, let’s do this!

How to create a GSuite Account

Before you can use the Google Cloud Platform, you have to have a GSuite account. There are two ways to do this, either you use your existing company email address or sign up to GSuite and create your company on Gmail.

For learning purposes, you can use your personal Gmail account but to get the full experience of GCP, Google doesn’t recommend that you use a personal Gmail account.

Go to the Gsuite homepage and click on the “Get Started Now” button.

Type in your business name, the number of employees in your company and your country.

Fill in your contact details here — the information you provide will be used as the Gsuite account admin and this person will be in charge of managing your business’s Gsuite account.

Select the option that best describes your current situation. I normally get my domain from another provider, so I would choose the “Yes” option.

Having clicked the “Yes” option, I am now asked to provide the name of my domain.

At this point, I verify that I want to use this domain to set up my Google account. Alternatively, I could choose to buy a different domain via Google.

Click ok, if you want Google to send you marketing offers, otherwise just hit “No Thanks.”

Enter your details here — note: the username will be used for the main account email. This will also be the email you will use for the Google Cloud Platform.

Google automatically signs you up for the Business payment plan, but you can downgrade to the basic plan anytime.

Review the details you’ve entered and make sure you don’t have any typos before hitting the next button.

Congratulations! You’ve created your account. Now the final step will be to activate your Gmail for the domain you’ve just created. Hit the “Continue To Setup” button and click the “Next” button.

Click the “Activate” link on the right. If your domain is with a third party company, then you will be taken to another page where you sign into the third party website so that Google can authenticate you and activate your Gmail with the domain you provided.

After clicking on the “Sign In To Activate” button, you’ll need to wait for about 5 mins for the activation to complete.

At this point, you don’t need to create new users, but you can do so later by going to the Admin Console. Awesome for making it this far! You’re all set to get started with hosting your WordPress site on Google Cloud.

How to sign up for Google Cloud Platform

Click on the “Get Started” for free button

Agree to the terms and conditions and click next.

Enter your details (for privacy reasons I’ve greyed out my address), including your payment details. As it says on the screen, you won’t be charged till trial ends, but Google asks for payment details to ensure you’re not a spam robot. After you’re done click on “Start My Free Trial.”

Once you’ve successfully registered, you’ll be taken to a welcome page. Click on the top-section where it says “My First Project,” from there create a new project.

Before you click on “New Project” make sure that your domain is showing on the top, where it says “Select From.” Google uses this as your organisation. You will also notice that a default project has been created for you, but we’ll be creating a project from scratch. It’s important to understand this step, as you need to launch your virtual machine inside a project.

You can name your project anything you want, but for simplicity, I’ll name it “WordPress Site,” as that’s what we’ll be creating in this tutorial. Leave the organisation as your domain name and click “Create.” You are now ready to create a virtual machine and deploy your WordPress site inside it.

How to deploy your WordPress site

From the GCP dashboard, click the hamburger menu on the top-right corner and choose “Marketplace.”

Enter WordPress on the search bar.

You’ll notice there are lots of options for deploying WordPress in a VM, but for this tutorial, we’ll be using the Google-one-click deploy. It comes at a great price and has everything you need to get started without being overloaded.

Click on launch. You will have to wait for a few minutes whilst it configures the APIs you need.

Choose any deployment name you want, for simplicity I’m going to name it “wordpress-site.” Note* that Google has a certain naming convention for deployment names.

Deployment name can only contain lowercase characters, numbers or dashes. It must start with a lowercase letter and cannot end with a dash.

For the zone, I’m going to choose “US-West1-a,” it is based in Oregon and is part of the free tier. It’s best to choose the zone that is closest to your users, but when you’re starting out you may not know where the majority of your users will be based. Don’t stress about this, when your site becomes popular, you can create a more detailed configuration of how content is routed to your users, this is what Content Delivery Networks are for.

The default machine type is a small(1 shared vCPU) which costs $13.61 per month. For learning purposes this is just fine, you can play around with WordPress and teardown the deployment later. However, if you’re looking to host your actual site, then I would recommend going for the 1vCPU. You’ll notice a jump in the price to $24.75 per month.

The administrator email will be used as your admin and login email for your WordPress site. Make sure you tick the “Install phpMyAdmin.” This gives you backend access to your site content.

The Boot Disk Type option that I normally go for, is the “SSD Persistent Disk.” It does increase the price by a dollar more, but I think it’s a good trade-off because it performs better. Leave the default Boot Disk Size as 10. Leave the default networking that is provided. Tick, “Allow HTTP traffic from the Internet” and “Allow HTTPS traffic from the Internet.”

I’m a real data geek who loves keeping an eye on my metrics so I tend to tick the “Enable Stackdriver Logging” and “Enable Stackdriver Monitoring.” Ok, review your entries one more time and click deploy. At the time of writing, our options will total $25.27, but don’t worry as Google won’t charge you a pretty penny for it.

You have successfully deployed your WordPress site on the cloud — congrats and a major pat on the back.

The deployment manager shows you all the login in credentials you need, I’ve greyed-out mine for privacy. Your usernames and (temporary) passwords are all in here, so go ahead and check out your new deployment.

How to connect your domain to your WordPress deployment

Click on the hamburger menu and select APIs and Services.

Select “Enable APIs and Services.”

Search for “cloud DNS” and click on the Google Cloud DNS API and click “Enable”.

Click on the hamburger menu and select “Networking Services” and choose “Cloud DNS.” Once on the Cloud DNS page click on the “create zone” button.

Leave the zone type as public. Enter the name of your site in the zone name field and the root domain in the DNS name field. Leave the DNSSEC as the default off and description is optional. After the zone is created, click on the “Add Record Set” on the top of the next page.

Firstly, you’ll need to create an “A-record.” If not already selected, then select A in the resource record type. For the IPv4 address, click the hamburger menu and select Compute Engine > VM instances.

Copy the “External IP,” paste it inside the IPv4 address of the A record page and click create.

From the Cloud DNS page click on the “Add Record Set.” Here we’ll be adding the CNAME record. Enter “www” as the DNS name, choose CNAME as the Resource Record Type and enter the domain name for the Canonical name and click create.

At this point, you should have 4 record types, A, SOA, NS and CNAME. Go to your domain name provider, click on either the “DNS” or “manage” button next to your domain name and replace your current nameservers with the NS records provided to you by Google. I have not included an image for this next step as the options will vary depending on the domain provider, but there will be an option to select your own custom name servers, so choose that option.

Notice the “fullstop” at the end of each NS record? DO NOT include them in your entries.

Using the credentials from your Deployment Manager, log into your WordPress admin. From the admin dashboard, go to settings and general. Replace your Google assigned site IP address with the domain you used to set the NS records. Click on “Save Changes.”

Congratulations! You’re now successfully pointing your domain, to your new WordPress deployment. However, we’re not quite done. Notice how it says, “Not Secure” on the search bar right next to your site’s URL? This is because you do not yet have an SSL certificate. Your website will definitely need an SSL certificate if you’re asking for personal details.

How to get an SSL certificate for your WordPress site

Ok, so this final part will involve a bit of coding, but I promise it’ll be pretty painless.

Click on the hamburger menu, go to Compute Engine and select VM instances.

Click on the “SSH” button — it will take a few seconds to establish a connection with your virtual machine.

Once connected, this is what you’ll see. I’ve greyed-out the host fingerprint for privacy reasons.

Type in this command.

lsb_release -a

Take note of the configuration of your VM and head over to

From the drop-down options choose your VM’s operating system, make sure these correspond to the information from the previous step. In my case, it’s an Apache — Debian (9 Stretch).

After you’ve chosen your VM’s operating system specifications, scroll down and copy the piece of code to install the Certbot.

sudo apt-get install certbot python-certbot-apache

In your SSH terminal, paste the Certbot code you copied in the previous step.

Type “Y “ and press enter. It will run for a couple of seconds downloading all the packages it needs.

Head back to the Certbot page and copy the following code.

sudo certbot --apache

Paste the code in the terminal.

Enter the email address you would like to use for renewal notifications.

Agree to the terms and conditions.

Fill in the necessary fields with your own information, replacing with your own domain. After this step has been successfully completed, restart the apache webserver using the following code.

sudo service apache2 restart

Now head back into your WordPress admin, go to settings and general. Add an “s” at the end of the “http” and click the “Save Changes” button.

Go to the browser and type in your url — notice how the little padlock has replaced the “not secure” sign. This means your site is now legit.

Final Thoughts

Congratulations on making it to the end of this tutorial, you’ve just tech-hustled your company some sweet hosting for free — nice work! Leave a comment if you have any questions.

I love saving people hours of technical frustration, so let me know if you want to see more tutorials like this from me. Now, go and make something awesome and send me a link.

get the best real-world tutorial, right to your inbox!

    let's get social!

    recent posts

    Get the best real-world projects, right to your inbox!