DEV Community

Tohid Azimi
Tohid Azimi

Posted on

How I Deployed WordPress on GCP Cloud Run for 30-60% Cheaper Than Managed Hosting

I was thinking about hosting my personal blog. When researching WordPress hosting options, WP Engine and Kinsta immediately stood out—but at $50-83/month for basic plans.

As a cloud platform engineer mostly working with Google Cloud, I thought there had to be a more cost-effective way. After some research and building, I put together a solution that costs around $30-35/month for typical usage.

I've made the complete infrastructure open source on GitHub in case it's useful for others.


The Problem I Was Trying to Solve

Creating a temporary WordPress site is easy, but running a live website needs reliable hosting. When I looked at managed hosting options, I found a few common issues:

Expensive black box hosting: You're paying $80+/month but don't really know what's running under the hood. Want to customize something specific? Often not possible.

No automated scaling: If your site gets a traffic spike, you either pay to upgrade to handle the peak (even when traffic is normal), or your site slows down.

Inflexible plans: What if your business needs change quickly? What if you're at 72K visits on a 75K-visit plan? You're forced to upgrade to the next tier even though you only need slightly more capacity—and most of those new resources sit unused.

For non-technical users, managed hosting makes total sense. But if you're comfortable with some cloud basics and want more control, there should be a middle ground.


What I Found in Existing Open Source Solutions

Before building, I looked at existing WordPress-on-GCP projects. They had some pieces but not everything I was looking for:

Google's Official WordPress on Cloud Run

Repository: deploystack-wordpress-on-cloudrun

  • Uses VPC Serverless Connector (which is being deprecated and costs more)
  • Doesn't show how media files (images/videos) are stored when Cloud Run scales
  • No clear credential management for database passwords
  • No built-in budget or cost monitoring

Serverless WordPress on Vercel/Netlify

Example: serverlesswp.com

  • No Infrastructure as Code setup for reproducible deployments
  • Doesn't include cost comparisons

AWS Serverless WordPress

Repository: aws-serverless-wordpress

  • Setup requires multiple manual steps
  • Doesn't include cost comparisons

What I wanted was something that combined Infrastructure as Code, proper credential management, cost monitoring, and automated media storage—all in one deployable package.


What I Built

I put together a WordPress deployment on Google Cloud Run with these components:

Cloud Run: Serverless WordPress containers that scale based on traffic

Cloud SQL: MySQL database with private IP

Cloud Storage: Storage for WordPress media files

Secret Manager: Secure storage for database and admin passwords

Terraform: Infrastructure as Code so the setup is reproducible

One-command deployment: A script that handles the setup


Current cost: Around $30-35/month for typical small business traffic

Why this setup:

  • Pay for what you use: Cloud Run scales to zero when there's no traffic
  • No vendor lock-in: It's your infrastructure, you can modify or move it
  • Reproducible: The Terraform code means you can deploy the same setup anywhere
  • Cost monitoring: Budget alerts built in so you don't get surprised

Compared to WP Engine at $50-83/month for similar traffic levels.


Why Serverless (Cloud Run) Over Traditional VMs?

I considered using traditional VM-based hosting. Here's why I went with serverless:

Traditional VMs

Fixed costs:

  • Pay 24/7 even with zero traffic
  • Over-provision for peak traffic
  • Underutilized resources most of the time

Manual scaling:

  • Add more VMs manually
  • Configure load balancers
  • Manage OS updates and security patches

Operational overhead:

  • Server maintenance
  • Monitoring and alerting setup
  • Backup management

Cost for typical blog: $50-100/month minimum

Cloud Run (Serverless)

Variable costs:

  • Pay only when handling requests
  • Zero traffic = $0 compute cost
  • Scale automatically from 0 to thousands

Zero maintenance:

  • No OS to patch
  • No servers to manage
  • Google handles infrastructure

Built-in features:

  • Automatic HTTPS
  • Blue-green deployments
  • Request logging

Cost for typical blog: $9-30/month (70% savings)

The Trade-off: Cold starts (~2-5 seconds for first request after idle period). For blogs and business sites with variable traffic, this is acceptable. For high-traffic always-on applications, consider keeping min instances at 1.


Cost Breakdown

Here's what this actually costs for a typical small business site with moderate traffic:

Service Details Monthly Cost
Cloud Run 2 vCPU, 2GB RAM ~$24
Cloud SQL db-f1-micro (0.6GB RAM) ~$10
Cloud Storage 10GB media storage ~$0.60
Artifact Registry Container images ~$0.95
Secret Manager 3 secrets $0 (free tier)
Total ~$35/month

In comparison, managed hosting basic plans:

  • WP Engine: $59/month
  • Kinsta: $50/month

Note: I haven't fully load-tested all configurations yet, so these numbers are estimates based on my current usage. Your actual costs will vary depending on your traffic patterns.

Bonus: New Google Cloud accounts get $300 in free credits valid for 90 days. At $35/month, that covers your first 3 months essentially free.


What You're Trading Off

To be honest about what you're giving up with this approach:

You manage WordPress updates yourself: No automatic updates for WordPress core or plugins. You'll need to do this manually through the WordPress admin (takes about 10 minutes a month).

No 24/7 WordPress support: If something breaks, you're troubleshooting it yourself or asking in GitHub discussions/Stack Overflow. Managed hosts have dedicated WordPress experts on call.

Requires basic cloud knowledge: You need to understand concepts like projects, services, and billing. If you've never used a cloud provider before, there's a learning curve.

Cold starts: After your site has been idle, the first request takes 2-5 seconds while the container warms up. Subsequent requests are fast. You can keep one instance always running for an extra ~$10/month if this matters.


Who This Is For (And Who It's Not For)

This might work well for you if:

  • You're spending $500-2,000/year on WordPress hosting and want to cut costs
  • You're comfortable with terminal commands and following technical documentation
  • You're okay managing your own WordPress updates
  • You want to learn Infrastructure as Code
  • You're a developer or agency managing multiple client sites

This probably isn't for you if:

  • You have zero technical experience (never used terminal/command line)
  • You need 24/7 WordPress-specific support
  • You want someone else to handle everything
  • Your site needs guaranteed sub-100ms response times
  • You need WordPress multisite (not supported yet)

Why I'm Open Sourcing This

A few reasons:

Get feedback: I don't know if this actually solves problems for others until people try it and tell me what's missing or broken.

Learn from others: Someone will probably find bugs I missed or think of features I didn't consider.

Give back: I've benefited from open source projects for years. Seems fair to contribute something back.

The code is free to use. If people find it useful and want help with custom setups or migrations.


Future Plans

Depending on community feedback and interest, I'm thinking about adding:

  • FinOps support: Better cost tracking and optimization recommendations
  • Governance and compliance: GDPR toolkit, audit logging improvements
  • Content Delivery Integration: Cloud CDN setup for faster global delivery
  • Custom domain automation: Simpler process for mapping your own domain
  • Multi-site support: WordPress multisite configurations

If you have other ideas or needs, let me know in the GitHub discussions.


Get Started

The complete code and documentation are on GitHub:

👉 GitHub Repository

What's included:

  • Full Terraform infrastructure code
  • One-command deployment script
  • Documentation
  • Cost estimation tools

Prerequisites: Google Cloud account and basic familiarity with terminal/command line.


Questions & Community

Have questions? Want to contribute?


Wrapping Up

I built this because I wanted cheaper WordPress hosting with more control. After some evenings and weekends, I have something that costs around $30-35/month instead of $50-83/month, and I can modify it however I want.

It's not perfect—there are definitely rough edges and things I haven't fully tested yet. But if you're technical enough to follow deployment instructions and comfortable managing your own WordPress updates, this might save you some money.

Is this useful? Missing something important? I'd love to hear feedback in the GitHub discussions or in the comments section.


If you found this helpful, star the repo or share it with someone who might benefit.

Top comments (0)