Published on

WordPress the easy way – Google Cloud

Authors

Recently I had to make a tough decision: where to host a WordPress blog. For a small-scale WordPress website, major cloud providers are usually an overkill, since you can find a lot of user-friendly, cheap, and simple solutions that provide just enough features for users who just want to deploy their website with a couple of clicks. If you don’t want to deal with a compute capacity, install PHP and MySQL, install certificates and configure DNS there is absolutely no reason to go down that road. Anyhow, my use case was a bit different, I was ready to get my hands dirty, wanted everything under my control, wanted to be able to scale, and since I’m starting a few other cloud-related projects I wanted to have all my costs and configuration under the same umbrella. This is the reason why I did an investigation on how can I spawn a WP instance in a fairly simple manner, but on a major cloud provider (in this case, Google Cloud).

[If you are interested in how to easily deploy WordPress on AWS, you can read part 1 here: https://www.zeljkovic.sh/blog/2021/wordpress-the-easy-way-aws]

WordPress on Google Cloud

When it comes to Google Cloud’s offer to create a WordPress instance, it provides a very clear overview of which three hosting types you have, which Google Cloud services they are utilizing, and what use case is applicable to which option:

WordPress options on Google Cloud
WordPress options on Google Cloud

After initial analysis, the most appropriate solution for my use case is a virtual machine on a Compute Engine:

  • Low to medium traffic
  • Basic scalability
  • Blog and CMS

If you choose the first option, you will get an overview page where the user is able to see technical details about the deployment (type, version, OS, package contents, etc.). Estimated pricing details are visible below:

Default pricing
Default pricing

Be aware that this pricing model is valid for the:

  • given VM instance
  • given persistent disk
  • with sustained use discount
  • for the Central US region

It is very likely that the user will change any of these, so the pricing may vary significantly.

Instance creation

The new WordPress deployment page provides the following settings to the user:

  • machine settings
  • disk settings
  • network interfaces
  • firewall settings
  • Stackdriver settings (performance monitoring and troubleshooting service)

Once you click the Deploy button, the Deployment manager window is displayed with the progress of the deployment. As soon as the deployment is done, the user is provided with the public IP address of the instance and detailed instance properties.

Deployed instance details

Don’t worry, this instance does not exist anymore

Customization and monitoring

Google Cloud allows you to completely customize your WordPress instance. User is provided with the MySQL access credentials, phpMyAdmin web interface (in case it was checked during deployment preparation), and quick access to the wp-admin area and SSH connection to the WordPress instance. This way, the user is having full access to the instance internals, which leaves endless possibilities to tune your WordPress under the hood.

To complete the setup process, few other things are left to be configured:

  • set up firewall rules
  • change default temporary passwords
  • attach the static IP address to the instance (additional charges may occur)
  • buy a domain and configure DNS – Google Cloud does not provide a service for this (like AWS Route53), but Google has a service called Google Domains if the user wants to stay within the Google ecosystem (be aware that at the time of writing this article Google Domains is in beta and does not provide its services in all countries – see the full list here: https://support.google.com/domains/answer/4639612?hl=en)

When it comes to monitoring the WordPress instance, the user needs to create his own set of custom metrics and alerts if he wants to avoid any unpleasant surprises regarding availability and reliability. Despite the quick deployment of the instance, it is still just a regular Google Cloud Compute Engine VM, which means that any good practices related to this type of computing resource should be applied here as well. Out of the box, the user will be provided with the very basic set of default metrics:

  • CPU Utilization
  • Network Traffic
  • Disk I/O
  • CPU Usage
  • Uptime Checks (needs to be configured)

This should do the trick for basic small-scale usage of WordPress, but for any business-sensitive use cases more detailed monitoring together with alerting should be configured. Also, if you want advanced monitoring, there is a Stackdriver option that is offered during the instance creation.

Conclusion

If you’re not scared of getting deeper into technical stuff and you want a highly customizable solution, Google Cloud is the right choice. Some pros and cons of this solution are:

Pros:

  • a very clear breakdown of deployment possibilities
  • full customization
  • tightly coupled with other Google Cloud services

Cons:

  • a bit higher price
  • not recommended for tech noobies

https://cloud.google.com/wordpress

https://cloud.google.com/compute/docs/ip-addresses/reserve-static-external-ip-address#reserve_new_static

https://domains.google/