How to Install WordPress on Google Cloud

As your site grows, attracts more visitors, and becomes an income source, you can no longer accept downtime or slow-downs. That’s when you know it’s time to invest in a more reliable hosting solution. For this, Google Cloud is one of the best options out there.

In this article, I’ll cover how to install WordPress on Google Cloud and what benefits you’ll reap for it. If you’re looking for a real environment experience, look no further than Cloud Academy’s Deploy WordPress using CloudFormation. This hands-on lab allows you to create your first cloud infrastructure using Amazon Cloud. This real-world lab experience will have you working directly in an Amazon Web Services (AWS) environment, and you will use the AWS Management Console to complete all the lab steps.

Deploy WordPress using CloudFormation

 

What is cloud hosting?

Before we start, let’s get a better understanding of what cloud hosting and Google Cloud is. Cloud hosting is, on the surface level, similar to any other hosting service – it gives you space, resource, and a control panel that allows you to control and keep a website online. The key difference lies within the infrastructure. Cloud computing uses multiple serves arranged in clusters, that allow hosting your files on multiple physical devices at once. The files can be fetched from either one of the servers that are part of the cloud.

Why should you install WordPress in a cloud environment?

Now that you know what cloud hosting can offer you – incredibly powerful alternative compared to other web hosting services – let’s look at the main benefits that you’ll get with Google Cloud:

  • Google cloud caters to traffic spikes effortlessly – whenever your website experiences a massive surge of visitors, Google Cloud uses dynamic scaling for your resources, which adds additional bandwidth, or whatever other resource is required, making every single visitor experiences your website without slowdowns.
  • Uptime guaranteed – since Google Cloud is essentially a network of servers, you are assured that the site will not face downtime. When you host your website, its files won’t be located on a single server. This guarantee means that if Server A is experiencing issues, then the site will be served from Server B which is functioning fine and still has all your site data ready to be brought up.

How to install WordPress on Google Cloud

First, we’ll set up a Google Cloud account, and install WordPress on the Google Cloud Platform. For this step, you don’t yet need a domain name. Additionally, if you’ll be transferring your site, the process will be slightly different. While changes are being made to your website, you should make your site private until the process is complete.

While this tutorial will focus on installing a site on Google Cloud, to transfer an existing one you’ll have to set up WordPress and import a backup of your old site’s files and database to its new home. Make sure to check if the database name, username, and password are the same after the import is complete.

1. To begin,  go to cloud.google.com and create your personal account. Here, enter your address, name, and your credit card details. You can opt for the optional free trial.

2. After that, open the GCP Console. Head over to https://console.cloud.google.com/start or click the Console button on the present page.

3. Next, you need a Project. Click on the automatically generated “My First Project” tab.

Google Cloud Platform

In the popup box, you can adjust the information as you see fit.

4. Next, go to the Marketplace, located on the left sidebar.

5. On the next screen, there will be several apps that can be installed on the virtual machine that will be created. Here, search for WordPress using the search box, find it and select it.

Google Cloud Marketplace

Set up WordPress

Now we’re going to set up WordPress on the compute engine.

1. Hit LAUNCH ON COMPUTE ENGINE.

WordPress - Launch on Compute Engine

As seen in the screenshot below, here you can adjust the name, zone, and other details of the deployment. Be sure to select a name and enter an administrator email, and to allow both HTTP and HTTPS traffic, by ticking the boxes at the bottom. For this tutorial, we’ll leave the other fields with their default values.

New WordPress Deployment

After clicking the Deploy button, wait for a while to complete the installation. Once it is finished, you can access the freshly launched WordPress site by accessing its IP address. But as IP addresses don’t make for a very good first impression, next we’ll link a domain name to your Google Cloud powered WordPress site.

Add domain to Google Cloud platform

As previously mentioned, having a domain is optional, but definitely recommended. To connect a domain to the Google Cloud Platform, follow these steps:

1. Access the VPC Network on the Dashboard, and select external IP addresses.

2. The default selection under the Type column will be Ephemeral. Click on the drop-down menu and choose Static instead.

Choose static

3. With the crucial part done, we’ll need to allow the Google Cloud DNS API. Click on APIs and services on the left sidebar, and select the Library. Use the search bar to find the Google Cloud DNS API and click the Enable button.

Google Cloud DNS API

After that, come back to the Dashboard and go to the Compute Engine. There, find your WordPress instance and copy its External IP, as you’ll need it in the next step. This is the same IP address as your site address.

4. From here, go to Network services > Cloud DNS. Here, click CREATE ZONE.

Google Cloud DNS

Fill in the following boxes:

  • Zone name – how you want to name the specific zone.
  • DNS name – your registered domain name, without a prefix (E.g.: example.com)
  • Description – an optional description for the zone.
Google Cloud - Create a DNS Zone

Afterward, save the new zone.

4. Next, you’ll need to create two A record sets so users can access your site with and without the www prefix. To make this possible, click ADD RECORD SET and fill in these details:

  • DNS name – leave this field blank.
  • Resource Record Type – select A.
  • TTL Unit – select minutes.
  • TTL – select 5.
  • IPv4 Address – enter the external IP address that you copied earlier.

After doing that, again, click on the ADD RECORD SET button. This time around, create the same record, only make sure to add “www” to the DNS name field.Add Record Set

5. Next, you need to update the nameservers on your domain registrar’s account. Access your account, and find the domain management area. There, replace the default nameservers with those provided by Google Cloud, which can be found by clicking Registrar Setup at the top right corner of the Cloud DNS section.

Google Cloud - Registrar Setup

After you change the nameservers, you may need to wait for a while until the changes propagate. Once done, you’ll be able to visit your Google Cloud powered WordPress site through its new domain name.

Summary

Cloud hosting is the absolute bleeding edge in hosting solutions. It guarantees uptime, stability, speed, and much more. Best of all, it’s incredibly easy to set up and use – especially if you’re a WordPress user. In this tutorial, you learned how to Install WordPress on Google Cloud, and link a domain to it. Get ready to open your site up to a whole new world of possibilities.

All you need to do to complete the process is a Google account, and a domain name, along with access to its DNS settings. Complete the Google Cloud Project setup process, launch your WordPress site, link the domain with the help of the Google Cloud DNS API, and access your site’s WordPress dashboard.

Cloud Academy