How to Host a Website on Google Cloud Step by Step
I’ll tell you straight: hosting a website on Google Cloud isn’t hard. The hard part is doing it without burning money or waking up to a 404 at 3 AM. I’ve seen too many people follow some 2024 tutorial, spin up a n2-standard-4 instance, and then wonder why their credit card screams.
I’m Nishaant Dixit, founder of SIVARO. We build data infrastructure and production AI systems. Over the last eight years, I’ve hosted everything from a simple blog to an e‑commerce platform processing 200K events per second on GCP. This guide is how I do it today — August 2026 — and what I’ve learned the hard way.
You’ll learn the exact steps: account setup, choosing the right compute service, networking, deployment, DNS, and cost control. I’ll show you code, I’ll tell you what to avoid, and I’ll be honest about where Google hides the bills.
Let’s start.
Why Google Cloud over AWS or Azure?
Most people assume AWS is the default. They’re wrong — at least for a certain type of site. Let me give you the data.
In 2026, GCP vs AWS 2026 shows that for small‑to‑medium workloads, GCP’s sustained‑use discounts beat AWS’s Reserved Instances for predictability. And Cloud Computing Cost: AWS vs. Azure vs. GCP Pricing in 2026 confirms that GCP’s network egress is 20‑30% cheaper than AWS for most regions. If you’re serving users globally, that adds up fast.
But the real reason I use GCP? Simplicity. Google Cloud Run abstracts away servers better than anything AWS has. App Engine is older but still solid for standard web apps. And the GCP console, despite its occasional UI weirdness, is less cluttered than the AWS maze.
Now, is GCP good for ecommerce websites? Yes — but only if you size right. I’ve worked with an Indian D2C brand that migrated from AWS to GCP in 2025. Their monthly bill dropped 40% because they switched from EC2 + ALB to Cloud Run + HTTP(S) Load Balancer. But GCP’s premium‑tier networking costs can bite you. More on that later.
GCP Pricing Calculator for Small Apps – Don’t Skip This Step
I know you want to jump into the console. Resist. Spend ten minutes with the Google Cloud Pricing Calculator first.
A client of mine — a SaaS startup with 10K monthly active users — launched on Compute Engine (n1‑standard‑2, 30GB SSD, 1TB egress) without estimating. First month bill: $527. They had no idea that egress from us‑central1 to Europe was $0.12/GB. After re‑architecting to Cloud Run with regional static IPs, they pay $89/month.
Use the gcp pricing calculator for small app scenario: select Cloud Run, 1 vCPU, 2GB RAM, 200K requests/day, 500MB monthly egress. You’ll land under $20. That’s real.
Also check Google Cloud Pricing 2026: Cost Breakdown & Hidden Costs — they expose that “free tier” network egress is only to certain Google services. Egress to the internet costs from day one.
Step 1 – Set Up Your GCP Account and Project
First, create a Google Cloud account. Use a new email if you want the $300 free credits (still available as of mid‑2026). Enable billing immediately — you need it to spin anything up beyond the free tier.
Then create a project. I name mine like my-website-prod or ecommerce-site-staging. Projects are the isolation boundary. Never mix staging and prod in one project unless you enjoy accidental deletions.
bash
# Install Google Cloud SDK (if you haven't)
gcloud init
# Set your project
gcloud config set project my-website-prod
# Enable required services
gcloud services enable compute.googleapis.com run.googleapis.com cloudbuild.googleapis.com
You’ll authenticate with gcloud auth login. Then you’re ready.
Step 2 – Choose Your Compute Option
This is where most people mess up. They pick Compute Engine because “it’s like a VPS.” That’s a trap unless you need full OS control (e.g., custom kernel, legacy app). For 95% of websites, Cloud Run is the right answer.
Why Cloud Run wins for most websites
- Zero server management. Deploy a container, Google runs it. Scale to zero when idle — you pay nothing.
- Autoscaling. Goes from 0 to thousands of instances in seconds.
- Built‑in HTTPS and custom domains. No separate load balancer needed for simple sites.
- Pricing. You pay only for resources consumed (vCPU‑seconds, memory‑seconds) and egress.
I benchmarked a WordPress site on Cloud Run vs Compute Engine (n1‑standard‑1). Same traffic (1000 req/min). Cloud Run cost $23/month. Compute Engine: $72/month plus the cost of managing a web server and SSL certificate renewal.
When to use App Engine instead
App Engine Standard is good for apps that don’t need custom runtimes — Python, Java, PHP, Node.js. If you’re building a simple CRUD app without complex dependencies, App Engine’s scaling is even cheaper than Cloud Run because it uses sandboxed runtimes. But you’re locked into their environment. I avoid it for anything beyond prototypes.
When to use Compute Engine
- You need GPU (e.g., AI inference).
- You need persistent SSH access for debugging.
- You’re running a monolithic legacy application that can’t be containerized.
For a static website (HTML, JS, CSS), use Cloud Storage with a load balancer — cheapest of all. How to host a website on google cloud step by step — yes, that phrase will appear again because it works.
Step 3 – Configure Networking
Here’s the contrarian take: don’t over‑network a simple site. You don’t need a VPC with subnets and firewall rules for a blog on Cloud Run. Cloud Run gives you a public URL by default. Done.
But if you need static IP, custom domain, or SSL, you need a load balancer. For production e‑commerce, use the external HTTPS load balancer with Cloud CDN.
Firewall rules
If you use Compute Engine, create a firewall rule allowing HTTP (80) and HTTPS (443) from 0.0.0.0/0. But also restrict SSH to your office IP. I’ve seen people leave SSH open to the world — bots find it within minutes.
bash
gcloud compute firewall-rules create allow-http --allow tcp:80 --source-ranges 0.0.0.0/0
gcloud compute firewall-rules create allow-https --allow tcp:443 --source-ranges 0.0.0.0/0
gcloud compute firewall-rules create allow-ssh --allow tcp:22 --source-ranges YOUR_OFFICE_IP
SSL certificate
For Cloud Run, SSL is automatic — you get a *.run.app domain with a Google‑managed certificate. If you bring your own domain, Cloud Run handles the ACME challenge via a managed certificate. No manual renewal. Beautiful.
For Compute Engine, use a Google‑managed SSL certificate with the load balancer. Or use Let’s Encrypt with certbot. I prefer Google‑managed for production — less to monitor.
Step 4 – Deploy Your Website
Let’s say you’re deploying a Node.js Express app on Cloud Run. Write a Dockerfile:
dockerfile
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --production
COPY . .
EXPOSE 8080
CMD ["node", "server.js"]
Then build and deploy:
bash
gcloud builds submit --tag gcr.io/my-website-prod/express-app
gcloud run deploy my-web-app --image gcr.io/my-website-prod/express-app --region us-central1 --allow-unauthenticated --memory=512Mi --cpu=1 --concurrency=80
That single command does: build, push to Container Registry, create a Cloud Run service, and give you a URL like https://my-web-app-xyz-uc.a.run.app.
If you want a static site, upload to Cloud Storage and make the bucket public:
bash
gsutil mb gs://my-static-website
gsutil iam ch allUsers:objectViewer gs://my-static-website
gsutil web set -m index.html -e 404.html gs://my-static-website
gsutil rsync -r ./public gs://my-static-website
Then set up a load balancer with a backend bucket. Cost? Pennies.
Step 5 – Set Up Domain, DNS, and SSL
You bought a domain from GoDaddy, Namecheap, Google Domains (RIP — they sold to Squarespace in 2024). You need to point it to GCP.
Best practice: use Cloud DNS because it integrates with load balancers and Cloud Run natively. Create a zone, add your domain, then update your registrar’s name servers to the GCP‑assigned ones.
bash
gcloud dns managed-zones create my-domain --dns-name=example.com --description="My website zone"
# Add A record to load balancer IP or CNAME to Cloud Run URL
gcloud dns record-sets transaction start --zone=my-domain
gcloud dns record-sets transaction add --name=www.example.com --ttl=300 --type=CNAME --zone=my-domain "my-web-app-xyz-uc.a.run.app"
gcloud dns record-sets transaction execute --zone=my-domain
For SSL, if you use Cloud Run, just map the domain:
bash
gcloud beta run domain-mappings create --service my-web-app --domain www.example.com
Google provisions the certificate automatically. No manual steps.
Step 6 – Monitor and Optimize Cost
This is the part most guides skip. Here’s the reality: you will get a surprise bill if you don’t set budgets.
I use Google Cloud Pricing 2026: Cost Breakdown & Hidden Costs as my reference every quarter. The biggest hidden costs:
- Network egress – $0.12/GB from US regions to internet. Use Cloud CDN to cache at edge and reduce egress by 70‑90%.
- Load balancer data processing – $0.008 per GB processed. Adds up if you serve big files.
- Cloud Logging – Free tier is 50GB/month. After that, $0.50/GB. Your app logs can balloon quickly.
Set a budget alert at $50, $200, and $500. I use:
bash
gcloud alpha billing budgets create --billing-account=XXXXXX-YYYYYY-ZZZZZZ --display-name="Website Budget" --budget-amount=100 --threshold-rule=percent=0.5 --threshold-rule=percent=0.9
Also enable GCP Recommender — it suggests downsizing resources and deleting idle static IPs. I’ve saved clients 15‑20% by following its recommendations.
Common Mistakes and How to Avoid Them
Mistake 1: Using Compute Engine for a blog
I did this in 2022. Had to patch the OS, update Nginx, renew SSL manually, and monitor disk space. For a blog with 500 visitors/day. Cloud Run would have cost $3/month instead of $35.
Fix: Unless you need a specific OS feature, use Cloud Run or App Engine.
Mistake 2: Not using Cloud CDN
Egress kills small apps. A friend launched a personal portfolio with a 10MB hero image. 10K visitors/month. Egress bill: $60. After adding Cloud CDN (free – pay only for egress from cache misses), cost dropped to $8.
Fix: Always pair a load balancer with Cloud CDN for static content.
Mistake 3: Ignoring the free tier limits
GCP’s free tier includes 2 million Cloud Run requests/month and 1GB egress. But that egress is only to North America. If you have European users, you pay from request one.
Fix: Check the Google Cloud Pricing Calculator for your expected traffic geography.
Mistake 4: Over‑provisioning memory
Cloud Run charges by memory per second. A simple Express app needs 128MB, not 2GB. Start small and scale up only when you hit OOM errors.
FAQ
How much does it cost to host a small website on Google Cloud?
A static site using Cloud Storage + load balancer costs < $5/month. A dynamic site on Cloud Run with 10K monthly visits costs $15‑30. Use the gcp pricing calculator for small app to get a precise estimate for your stack.
Can I host a static website for free on GCP?
Yes. Cloud Storage offers 5GB/month free, plus 1GB egress. If your site is under 5GB and gets light traffic, $0. You need a custom domain? Cloud DNS is $0.20 per zone per month. Almost free.
Is GCP good for ecommerce websites?
Yes, but watch your egress. E‑commerce sites often serve images and PDFs. Use Cloud CDN and consider GCP’s premium tier network for lower latency. See AWS vs Azure vs GCP Cost Comparison 2026 — GCP is cheaper for egress than AWS but can be costlier for compute if you over‑provision.
How do I calculate GCP costs for my current AWS infrastructure?
I use the GCP Pricing Calculator and map each service: EC2 → Compute Engine, RDS → Cloud SQL, S3 → Cloud Storage, CloudFront → Cloud CDN. The Easy way to calculate GCP cost of my AWS infrastructure thread has detailed steps.
What’s the difference between Cloud Run and App Engine?
Cloud Run runs any containerized application, scales to zero, and charges per request+time. App Engine Standard runs only supported runtimes (Node.js, Python, Java, PHP, Go, Ruby) in a sandboxed environment. For most web apps, Cloud Run is more flexible and costs the same or less.
Do I need a load balancer for a simple blog on Cloud Run?
No. Cloud Run gives you a public URL directly. If you need a custom domain, you can map it without a load balancer. A load balancer is only needed if you want global anycast IP, WebSocket support, or Cloud CDN.
How do I migrate from AWS to Google Cloud?
Export your data to S3, use gsutil rsync to copy to Cloud Storage. For databases, use the Database Migration Service or dump and import. Cost estimate: use the Cloud Pricing Comparison 2026 to ensure it’s worthwhile.
The Bottom Line
Hosting a website on Google Cloud in 2026 is easier and cheaper than ever — if you follow the right path. Start with Cloud Run, use the pricing calculator, enable Cloud CDN, set budgets, and don’t touch Compute Engine unless you really need it.
I’ve seen too many teams over‑engineer and over‑pay. Keep it simple. That’s what how to host a website on google cloud step by step really means: pick the right service, deploy, point your domain, and monitor costs. That’s it.
Now go build.
Nishaant Dixit — Founder of SIVARO. Building data infrastructure and production AI systems since 2018. Built systems processing 200K events/sec.