Kanji
・Cloud engineer / freelance ・Born in 1993 ・From Ehime / Living in Shibuya, Tokyo ・5 years AWS experience Profile details
Table of Contents
min-instances=0
min-instances=1
$0.12/GiB
When I originally wrote this article back in May 2022, I compared the monthly cost of serving a static website from an Nginx container on Google Cloud Run against Firebase Hosting. At the time, my spreadsheet suggested that once monthly outbound data transfer exceeded roughly 600 GB (e.g., 2.0 MB per page across 300,000 monthly pageviews), Cloud Run would actually become cheaper than Firebase Hosting.
Over the past four years of running production workloads on Google Cloud—including operating this very blog (Moderniser) on Firebase Hosting—I realized that my original 2022 calculation contained two costly blind spots that trip up many engineers in real-world deployments.
First, my original Cloud Run calculation assumed an always-on instance ( min-instances=1 with CPU always allocated, now called Instance-based billing) . On one internal documentation project, I deployed a containerized static site to Cloud Run with --min-instances=1 --no-cpu-throttling to avoid cold-start latency and left it running for a month. Even though the site had almost zero traffic, the monthly invoice came back with $42.73 in Cloud Run vCPU charges alone (2,592,000 seconds of idle CPU allocation). When I switched that service back to Cloud Run’s default Request-based billing ( --min-instances=0 --cpu-throttling ) , CPU was only billed during the 20 milliseconds it took Nginx to serve each request. Even at 300,000 requests per month, total active CPU time was only 6,000 vCPU-seconds—well inside the 180,000 vCPU-second monthly free tier—dropping compute cost to $0.00 .
--min-instances=1 --no-cpu-throttling
--min-instances=0 --cpu-throttling
Second, my original calculation used Google Cloud’s Standard Tier network egress rate ( $0.085/GiB ) for Cloud Run. In reality, when you expose a Cloud Run service directly to the internet via *.run.app or custom domain mapping without an external load balancer, Google Cloud forces Premium Tier network egress ( $0.12/GiB from Tokyo asia-northeast1 ) . To unlock Standard Tier ( $0.085/GiB ), you must place an External Application Load Balancer in front of Cloud Run, which immediately adds at least $18/month in fixed forwarding-rule charges.
$0.085/GiB
*.run.app
asia-northeast1
With those real-world lessons factored in, the takeaway is straightforward: For purely static websites (HTML/CSS/JS), Firebase Hosting is overwhelmingly simpler and cheaper out of the box because global edge CDN caching and automated SSL are built in with zero compute billing. And if your site’s bandwidth bill is climbing past a few hundred gigabytes per month, the real fix isn’t migrating to an Nginx container on Cloud Run—it’s converting your images to WebP and offloading heavy media assets to Cloud Storage / Cloud CDN.
▲ Architectural and monthly cost comparison across Standalone Firebase Hosting, Standalone Cloud Run (Request vs. Instance billing), and the Production Hybrid Architecture
Let’s start by comparing the exact Always Free monthly allowances and overage unit rates for Google Cloud Run in the Tokyo region ( asia-northeast1 , Tier 1 pricing) versus Firebase Hosting on the Blaze (pay-as-you-go) plan.
(Note: In the 2022 version of this post, the formulas subtracted 240,000 vCPU-seconds and 450,000 GiB-seconds as the free tier; the official Google Cloud Always Free tier across a billing account is 180,000 vCPU-seconds and 360,000 GiB-seconds per month. All calculations below use the current official quotas.)
$0.10 / GB / month
$0.026 / GB / month
$0.00002400 / vCPU-second
$0.00001800 / vCPU-second
$0.00000250 / GiB-second
$0.00000200 / GiB-second
$0.40 / 1,000,000 requests
$0.12 / GiB
$0.15 / GB
When deploying an Nginx or Node.js container to Cloud Run, two flags determine whether your idle compute cost is $0.00 or $44.00/month :
$0.00
$44.00/month
# Pattern A (Recommended): Allocate CPU only during requests and scale to zero when idle gcloud run deploy static-nginx \ --image=asia-northeast1-docker.pkg.dev/my-project/web/nginx:latest \ --region=asia-northeast1 \ --cpu=1 \ --memory=256Mi \ --min-instances=0 \ --cpu-throttling \ --concurrency=80 # Pattern B (Legacy 2022 assumption / Not recommended for static sites): Keep 1 warm instance 24/7 gcloud run deploy static-nginx-always-on \ --image=asia-northeast1-docker.pkg.dev/my-project/web/nginx:latest \ --region=asia-northeast1 \ --cpu=1 \ --memory=256Mi \ --min-instances=1 \ --no-cpu-throttling
Under Pattern A ( --min-instances=0 --cpu-throttling ), if Nginx takes an average of 20 ms ( 0.02 seconds ) to serve a request, serving 300,000 requests in a month consumes at most 300,000 × 0.02s = 6,000 vCPU-seconds (and even less when concurrent requests overlap on the same container instance). Because 6,000 vCPU-seconds is just 3.3% of the 180,000 vCPU-second monthly free tier, your compute, memory, and request charges are $0.00 , leaving only outbound network egress ( $0.12/GiB ).
0.02 seconds
300,000 × 0.02s = 6,000 vCPU-seconds
Under Pattern B ( --min-instances=1 --no-cpu-throttling ), a 30-day month ( 2,592,000 seconds ) of continuous 1 vCPU / 256 MiB allocation costs $44.00/month before a single visitor even loads your site.
2,592,000 seconds
Let’s compare four payload scenarios at 10,000 daily visits (300,000 monthly visits across 100 pages): 1.0 MB, 2.0 MB, 3.0 MB, and a WebP-optimized 150 KB payload.
$0.15/GB
1 GB = 1,024 MB
((1.0 MB × 100 pages) / 1024 - 10 GB free tier) × $0.026/GB = $0.00
((1.0 MB × 10,000 reqs - 360 MB daily free tier) × 30 days / 1024) × $0.15/GB = 282.42 GB × $0.15 = $42.36
(6,000 vCPU-s - 180,000 free tier) × $0.000024 = $0.00
((6,000 s × 0.25 GiB) - 360,000 free tier) × $0.0000025 = $0.00
(300,000 reqs - 2,000,000 free tier) × $0.40 / 1M = $0.00
(1.0 MB × 300,000 reqs / 1024) × $0.12/GiB = 292.97 GiB × $0.12 = $35.16
((2,592,000 s × 1 vCPU) - 180,000 free tier) × $0.000018 = 2,412,000 × $0.000018 = $43.42
((2,592,000 s × 0.25 GiB) - 360,000 free tier) × $0.000002 = 288,000 × $0.000002 = $0.58
292.97 GiB × $0.12/GiB = $35.16
((2.0 MB × 10,000 reqs - 360 MB daily free tier) × 30 days / 1024) × $0.15/GB = 575.39 GB × $0.15 = $86.31
585.94 GiB × $0.12/GiB = $70.31
$43.42 + $0.58 = $44.00
$70.31
((3.0 MB × 10,000 reqs - 360 MB daily free tier) × 30 days / 1024) × $0.15/GB = 868.36 GB × $0.15 = $130.25
878.91 GiB × $0.12/GiB = $105.47
$44.00
$105.47
Looking strictly at the numbers above, you might wonder: “If Cloud Run with min-instances=0 charges $0.12/GiB for egress while Firebase Hosting charges $0.15/GB , why not host static sites on Cloud Run with scale-to-zero?”
In practice, standalone Cloud Run has two operational drawbacks for static sites: 1. No built-in Global Edge CDN : Every cold visitor or crawler hits your Tokyo container directly, suffering higher latency outside Japan and occasional container cold starts (300ms--800ms for Nginx). 2. A 1.0 MB--3.0 MB static page is an asset optimization problem, not a compute problem : Raw HTML, CSS, and JS for an article rarely exceed 50 KB. When a static page weighs 1 MB to 3 MB, over 90% of that payload consists of unoptimized PNG/JPEG images.
As this blog grew to hundreds of technical diagrams and multi-language thumbnails, average page weight approached 1.2 MB. Instead of moving off Firebase Hosting, I implemented three architectural changes:
<picture>
1200x630
600x315
immutable
firebase.json
Cache-Control: public, max-age=31536000, immutable
-v1.png
-v2.png
moderniser-repo-images
{ "hosting": { "public": "public", "headers": [ { "source": "**/*.@(webp|png|jpg|jpeg|gif|svg|woff2)", "headers": [ { "key": "Cache-Control", "value": "public, max-age=31536000, immutable" } ] } ], "rewrites": [ { "source": "/api/**", "run": { "serviceId": "moderniser-api", "region": "asia-northeast1" } } ] } }
As shown in Scenario D (150 KB/page × 300,000 monthly visits = ~43.9 GiB/month) , reducing page weight drops the monthly Firebase Hosting bill from $42.36 to $5.01 (an 88% reduction) . And for sites under ~70,000 monthly pageviews (~10.8 GB/month), the entire deployment runs for $0.00/month inside Firebase Hosting’s free tier.
Since 2024--2026, Google also offers Firebase App Hosting , a Git-centric full-stack hosting service designed specifically for SSR frameworks like Next.js and Angular. Under the hood, Firebase App Hosting automatically orchestrates Cloud Build, Cloud Run, Cloud CDN, and Secret Manager.
However, because App Hosting requires the Blaze plan and bills for underlying Cloud Build minutes, Artifact Registry storage, and uncached Cloud Run SSR execution, deploying a purely static site (SSG) onto App Hosting introduces unnecessary build and container overhead. Use the flowchart below to choose the right architecture for your workload:
Revisiting this cost comparison with 2026 pricing and four years of production telemetry highlights two critical rules: never leave min-instances=1 (always-on CPU) enabled on Cloud Run for a low-traffic or static site unless you want a mandatory $44/month baseline bill, and remember that direct Cloud Run internet egress is billed at Premium Tier rates ( $0.12/GiB in Tokyo) rather than Standard Tier ( $0.085/GiB ).
For static websites, documentation portals, and blogs, starting with standalone Firebase Hosting—combined with automated WebP image compression and immutable cache headers—delivers the lowest monthly cost and zero container maintenance. When you eventually need dynamic backend routes, attaching a scale-to-zero Cloud Run service via firebase.json rewrites gives you the best of both worlds.
Production guide to deploying Google Cloud Run with Cloud Build and Artifact Registry: least-privile ... [Read more]
Why we migrated all blog post permalink URLs from multibyte localized characters to clean alphanumer ... [Read more]
A comprehensive memorandum covering static vs dynamic site choices, hosting platform evaluation, cus ... [Read more]
Master conversation skills with realistic AI phone training and 5-axis feedback. Includes 16-lesson interactive academy and studio AI portraits.
Effortlessly snap receipts for instant AI itemization. Integrated with LINE for seamless group expense tracking and pain-free settlement.
Interactive AI personas (Fortune Teller, Butler, Bartender) host real-time games, challenges, and conversation starters for unforgettable gatherings.
Real-time AI quant analysis of earnings reports, corporate filings, and momentum indicators for global equities and Japanese stocks.
Unbiased healthcare database featuring zero-additive filters and active ingredient cost performance metrics.
Get the complete configuration pack featured in this article: universal AGENTS.md, deterministic hooks.json, Git safety guardrails, and validation scripts tested across Antigravity, Kiro, Claude Code, and Codex.